From 76b133aee46ffbfbec5b89190886d99f44f443d0 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 4 Jan 2022 09:34:41 +0000 Subject: [PATCH] CodeGen from PR 16659 in Azure/azure-rest-api-specs Merge 4204b14fd866887f5eb38ef183ff0a3309d01392 into 322d0edbc46e10b04a56f3279cecaa8fe4d3b69b --- 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 | 6 +- .../mgmt/storage/v2015_06_15/_metadata.json | 21 +- .../azure/mgmt/storage/v2015_06_15/_patch.py | 31 + .../v2015_06_15/_storage_management.py | 71 +- .../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/_models.py | 333 +- .../storage/v2015_06_15/models/_models_py3.py | 333 +- .../models/_storage_management_enums.py | 29 +- .../_storage_accounts_operations.py | 710 +- .../operations/_usage_operations.py | 85 +- .../mgmt/storage/v2016_01_01/__init__.py | 9 +- .../storage/v2016_01_01/_configuration.py | 6 +- .../mgmt/storage/v2016_01_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2016_01_01/_patch.py | 31 + .../v2016_01_01/_storage_management_client.py | 71 +- .../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/_models.py | 224 +- .../storage/v2016_01_01/models/_models_py3.py | 224 +- .../_storage_management_client_enums.py | 37 +- .../_storage_accounts_operations.py | 710 +- .../operations/_usage_operations.py | 85 +- .../mgmt/storage/v2016_12_01/__init__.py | 9 +- .../storage/v2016_12_01/_configuration.py | 6 +- .../mgmt/storage/v2016_12_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2016_12_01/_patch.py | 31 + .../v2016_12_01/_storage_management.py | 71 +- .../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/_models.py | 437 +- .../storage/v2016_12_01/models/_models_py3.py | 437 +- .../models/_storage_management_enums.py | 49 +- .../_storage_accounts_operations.py | 868 +- .../operations/_usage_operations.py | 85 +- .../mgmt/storage/v2017_06_01/__init__.py | 9 +- .../storage/v2017_06_01/_configuration.py | 6 +- .../mgmt/storage/v2017_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2017_06_01/_patch.py | 31 + .../v2017_06_01/_storage_management.py | 81 +- .../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/_models.py | 735 +- .../storage/v2017_06_01/models/_models_py3.py | 735 +- .../models/_storage_management_enums.py | 57 +- .../v2017_06_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 868 +- .../operations/_usage_operations.py | 85 +- .../mgmt/storage/v2017_10_01/__init__.py | 9 +- .../storage/v2017_10_01/_configuration.py | 6 +- .../mgmt/storage/v2017_10_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2017_10_01/_patch.py | 31 + .../v2017_10_01/_storage_management.py | 81 +- .../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/_models.py | 742 +- .../storage/v2017_10_01/models/_models_py3.py | 742 +- .../models/_storage_management_enums.py | 57 +- .../v2017_10_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 868 +- .../operations/_usage_operations.py | 85 +- .../mgmt/storage/v2018_02_01/__init__.py | 9 +- .../storage/v2018_02_01/_configuration.py | 6 +- .../mgmt/storage/v2018_02_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_02_01/_patch.py | 31 + .../v2018_02_01/_storage_management_client.py | 82 +- .../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/_models.py | 892 +- .../storage/v2018_02_01/models/_models_py3.py | 892 +- .../_storage_management_client_enums.py | 71 +- .../operations/_blob_containers_operations.py | 1062 ++- .../v2018_02_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 868 +- .../operations/_usage_operations.py | 163 +- .../storage/v2018_03_01_preview/__init__.py | 9 +- .../v2018_03_01_preview/_configuration.py | 6 +- .../v2018_03_01_preview/_metadata.json | 21 +- .../storage/v2018_03_01_preview/_patch.py | 31 + .../_storage_management_client.py | 88 +- .../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/_models.py | 934 +- .../v2018_03_01_preview/models/_models_py3.py | 934 +- .../_storage_management_client_enums.py | 73 +- .../operations/_blob_containers_operations.py | 1062 ++- .../operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1099 ++- .../operations/_usages_operations.py | 169 +- .../mgmt/storage/v2018_07_01/__init__.py | 9 +- .../storage/v2018_07_01/_configuration.py | 6 +- .../mgmt/storage/v2018_07_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_07_01/_patch.py | 31 + .../v2018_07_01/_storage_management_client.py | 93 +- .../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/_models.py | 1043 ++- .../storage/v2018_07_01/models/_models_py3.py | 1043 ++- .../_storage_management_client_enums.py | 77 +- .../operations/_blob_containers_operations.py | 1062 ++- .../operations/_blob_services_operations.py | 166 +- .../_management_policies_operations.py | 237 +- .../v2018_07_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 956 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2018_11_01/__init__.py | 9 +- .../storage/v2018_11_01/_configuration.py | 6 +- .../mgmt/storage/v2018_11_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2018_11_01/_patch.py | 31 + .../v2018_11_01/_storage_management_client.py | 93 +- .../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/_models.py | 1144 ++- .../storage/v2018_11_01/models/_models_py3.py | 1144 ++- .../_storage_management_client_enums.py | 79 +- .../operations/_blob_containers_operations.py | 1062 ++- .../operations/_blob_services_operations.py | 166 +- .../_management_policies_operations.py | 237 +- .../v2018_11_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1014 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2019_04_01/__init__.py | 9 +- .../storage/v2019_04_01/_configuration.py | 6 +- .../mgmt/storage/v2019_04_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2019_04_01/_patch.py | 31 + .../v2019_04_01/_storage_management_client.py | 103 +- .../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/_models.py | 1390 ++- .../storage/v2019_04_01/models/_models_py3.py | 1390 ++- .../_storage_management_client_enums.py | 85 +- .../operations/_blob_containers_operations.py | 1100 ++- .../operations/_blob_services_operations.py | 249 +- .../operations/_file_services_operations.py | 233 +- .../operations/_file_shares_operations.py | 424 +- .../_management_policies_operations.py | 237 +- .../v2019_04_01/operations/_operations.py | 74 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1024 ++- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2019_06_01/__init__.py | 9 +- .../storage/v2019_06_01/_configuration.py | 6 +- .../mgmt/storage/v2019_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2019_06_01/_patch.py | 31 + .../v2019_06_01/_storage_management_client.py | 154 +- .../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/_models.py | 2207 +++-- .../storage/v2019_06_01/models/_models_py3.py | 2207 +++-- .../_storage_management_client_enums.py | 117 +- .../operations/_blob_containers_operations.py | 1100 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 249 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 233 +- .../operations/_file_shares_operations.py | 519 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../v2019_06_01/operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 417 +- .../operations/_queue_services_operations.py | 233 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1131 ++- .../operations/_table_operations.py | 378 +- .../operations/_table_services_operations.py | 233 +- .../operations/_usages_operations.py | 90 +- .../storage/v2020_08_01_preview/__init__.py | 9 +- .../v2020_08_01_preview/_configuration.py | 6 +- .../v2020_08_01_preview/_metadata.json | 21 +- .../storage/v2020_08_01_preview/_patch.py | 31 + .../_storage_management_client.py | 179 +- .../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/_models.py | 2315 +++-- .../v2020_08_01_preview/models/_models_py3.py | 2315 +++-- .../_storage_management_client_enums.py | 121 +- .../operations/_blob_containers_operations.py | 1103 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 252 +- .../_deleted_accounts_operations.py | 162 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 233 +- .../operations/_file_shares_operations.py | 546 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 420 +- .../operations/_queue_services_operations.py | 233 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1137 ++- .../operations/_table_operations.py | 381 +- .../operations/_table_services_operations.py | 233 +- .../operations/_usages_operations.py | 93 +- .../mgmt/storage/v2021_01_01/__init__.py | 9 +- .../storage/v2021_01_01/_configuration.py | 6 +- .../mgmt/storage/v2021_01_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_01_01/_patch.py | 31 + .../v2021_01_01/_storage_management_client.py | 158 +- .../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/_models.py | 2376 +++-- .../storage/v2021_01_01/models/_models_py3.py | 2376 +++-- .../_storage_management_client_enums.py | 125 +- .../operations/_blob_containers_operations.py | 1100 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 249 +- .../_deleted_accounts_operations.py | 162 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 233 +- .../operations/_file_shares_operations.py | 541 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../v2021_01_01/operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 417 +- .../operations/_queue_services_operations.py | 233 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1131 ++- .../operations/_table_operations.py | 378 +- .../operations/_table_services_operations.py | 233 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2021_02_01/__init__.py | 9 +- .../storage/v2021_02_01/_configuration.py | 6 +- .../mgmt/storage/v2021_02_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_02_01/_patch.py | 31 + .../v2021_02_01/_storage_management_client.py | 158 +- .../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/_models.py | 2437 +++-- .../storage/v2021_02_01/models/_models_py3.py | 2437 +++-- .../_storage_management_client_enums.py | 127 +- .../operations/_blob_containers_operations.py | 1100 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 249 +- .../_deleted_accounts_operations.py | 162 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 233 +- .../operations/_file_shares_operations.py | 541 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../v2021_02_01/operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 417 +- .../operations/_queue_services_operations.py | 233 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1131 ++- .../operations/_table_operations.py | 378 +- .../operations/_table_services_operations.py | 233 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2021_04_01/__init__.py | 9 +- .../storage/v2021_04_01/_configuration.py | 6 +- .../mgmt/storage/v2021_04_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_04_01/_patch.py | 31 + .../v2021_04_01/_storage_management_client.py | 158 +- .../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/_models.py | 2676 ++++-- .../storage/v2021_04_01/models/_models_py3.py | 2676 ++++-- .../_storage_management_client_enums.py | 135 +- .../operations/_blob_containers_operations.py | 1193 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 249 +- .../_deleted_accounts_operations.py | 162 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 239 +- .../operations/_file_shares_operations.py | 652 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../v2021_04_01/operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 427 +- .../operations/_queue_services_operations.py | 239 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1131 ++- .../operations/_table_operations.py | 388 +- .../operations/_table_services_operations.py | 239 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2021_06_01/__init__.py | 9 +- .../storage/v2021_06_01/_configuration.py | 6 +- .../mgmt/storage/v2021_06_01/_metadata.json | 21 +- .../azure/mgmt/storage/v2021_06_01/_patch.py | 31 + .../v2021_06_01/_storage_management_client.py | 158 +- .../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/_models.py | 2896 ++++-- .../storage/v2021_06_01/models/_models_py3.py | 2896 ++++-- .../_storage_management_client_enums.py | 139 +- .../operations/_blob_containers_operations.py | 1193 ++- .../_blob_inventory_policies_operations.py | 342 +- .../operations/_blob_services_operations.py | 249 +- .../_deleted_accounts_operations.py | 162 +- .../_encryption_scopes_operations.py | 344 +- .../operations/_file_services_operations.py | 239 +- .../operations/_file_shares_operations.py | 652 +- .../_management_policies_operations.py | 237 +- ..._object_replication_policies_operations.py | 333 +- .../v2021_06_01/operations/_operations.py | 74 +- ...private_endpoint_connections_operations.py | 331 +- .../_private_link_resources_operations.py | 79 +- .../operations/_queue_operations.py | 427 +- .../operations/_queue_services_operations.py | 239 +- .../operations/_skus_operations.py | 91 +- .../_storage_accounts_operations.py | 1318 ++- .../operations/_table_operations.py | 388 +- .../operations/_table_services_operations.py | 239 +- .../operations/_usages_operations.py | 90 +- .../mgmt/storage/v2021_08_01/__init__.py | 18 + .../storage/v2021_08_01/_configuration.py | 71 + .../mgmt/storage/v2021_08_01/_metadata.json | 121 + .../azure/mgmt/storage/v2021_08_01/_patch.py | 31 + .../v2021_08_01/_storage_management_client.py | 160 + .../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 | 581 ++ .../storage/v2021_08_01/models/_models.py | 7640 +++++++++++++++ .../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 | 1718 ++++ .../_blob_inventory_policies_operations.py | 478 + .../operations/_blob_services_operations.py | 368 + .../_deleted_accounts_operations.py | 242 + .../_encryption_scopes_operations.py | 503 + .../operations/_file_services_operations.py | 348 + .../operations/_file_shares_operations.py | 907 ++ .../operations/_local_users_operations.py | 648 ++ .../_management_policies_operations.py | 352 + ..._object_replication_policies_operations.py | 482 + .../v2021_08_01/operations/_operations.py | 143 + ...private_endpoint_connections_operations.py | 474 + .../_private_link_resources_operations.py | 144 + .../operations/_queue_operations.py | 611 ++ .../operations/_queue_services_operations.py | 348 + .../operations/_skus_operations.py | 152 + .../_storage_accounts_operations.py | 1890 ++++ .../operations/_table_operations.py | 564 ++ .../operations/_table_services_operations.py | 348 + .../operations/_usages_operations.py | 158 + .../azure/mgmt/storage/v2021_08_01/py.typed | 1 + 608 files changed, 128603 insertions(+), 49600 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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.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 c3a7720c09003..97bab9f4c4b03 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": "d77c98cf5536627a18a6e2011bd1f7eaf1f33e2c", "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 --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 4f43cb650d315..9fd62cfe9c0c0 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 8a5a61e9f4ffc..32828b7cba73e 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 1ef5169b66ec6..3ee0c9646eb4e 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 f4381b05dccf4..b24c36bb24a2a 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 60a2d2a8e47eb..7f9c1caee1bb9 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 82424ef131541..b1e55270b0610 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 7927fed4220b3..8c0f0b3121b1f 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2015_06_15/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/_metadata.json index 998efaaaf4cb6..a93001c0fc16a 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 0000000000000..74e48ecd07cf3 --- /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 43c7f7af9233a..40bdb029c037d 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,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagement(object): """The Azure Storage Management API. @@ -33,52 +32,60 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 5bd005704dd71..95bb9e0d6b2cd 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 143c419958013..f084495f1d558 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 0000000000000..74e48ecd07cf3 --- /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 d3c0db37f3776..32852864a1b5f 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 1f268c4022685..e612fa80a4ebc 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 d9f8fdb6dbcc7..aeae13f705f97 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2015_06_15/models/_models.py index da3177373b8f8..fc475ff4e40d2 100644 --- 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 @@ -12,16 +12,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 = { @@ -34,6 +34,18 @@ def __init__( self, **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 = kwargs.get('name_available', None) self.reason = kwargs.get('reason', None) @@ -45,11 +57,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 = { @@ -65,6 +77,13 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -73,14 +92,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 = { @@ -94,6 +113,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.queue = kwargs.get('queue', None) @@ -112,10 +141,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 = { @@ -136,6 +165,12 @@ def __init__( self, **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 @@ -155,45 +190,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 = { @@ -225,6 +259,47 @@ def __init__( self, **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__(**kwargs) self.provisioning_state = kwargs.get('provisioning_state', None) self.account_type = kwargs.get('account_type', None) @@ -244,10 +319,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 = { @@ -263,6 +338,12 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + :keyword type: + :paramtype type: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] self.type = kwargs.get('type', "Microsoft.Storage/storageAccounts") @@ -273,20 +354,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 = { @@ -303,6 +384,22 @@ def __init__( self, **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 = kwargs['location'] self.tags = kwargs.get('tags', None) @@ -312,10 +409,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 = { @@ -327,6 +424,12 @@ def __init__( self, **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 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -335,8 +438,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 = { @@ -347,6 +450,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -356,8 +463,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 = { @@ -372,6 +479,10 @@ def __init__( self, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = kwargs['key_name'] @@ -379,17 +490,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 = { @@ -402,6 +513,19 @@ def __init__( self, **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 = kwargs.get('tags', None) self.account_type = kwargs.get('account_type', None) @@ -413,17 +537,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 = { @@ -444,6 +568,19 @@ def __init__( self, **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 = kwargs['unit'] self.current_value = kwargs['current_value'] @@ -454,8 +591,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 = { @@ -466,6 +603,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -473,10 +614,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 = { @@ -488,6 +629,12 @@ def __init__( self, **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 = 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 fb9488ef94b6f..a58a35e72490e 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 236a23fc4d428..b275bafa32539 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 a3cfe7a861289..1b9a691bc2d5b 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,26 +5,358 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +379,7 @@ 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" @@ -58,7 +391,8 @@ 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 @@ -69,30 +403,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,8 +430,10 @@ 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 @@ -121,32 +447,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +478,11 @@ 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 @@ -188,15 +507,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 +531,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,8 +557,10 @@ 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 @@ -268,25 +587,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,6 +610,8 @@ 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 @@ -327,27 +640,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,8 +664,11 @@ 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 @@ -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] + + _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,8 +734,11 @@ 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 @@ -449,8 +748,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.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 +759,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,11 +799,13 @@ 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 @@ -521,8 +819,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 +830,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,11 +872,13 @@ 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 @@ -607,27 +905,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,8 +929,11 @@ 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 @@ -661,7 +952,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 +964,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 +993,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 874c1311ea5c4..4477eee7d7700 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,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 +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/v2016_01_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/__init__.py index a50d1e1c39a72..1072dc1031610 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 2766e49ce18a8..426d2541aa468 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2016_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/_metadata.json index b0ff45d32019e..bda5a6a227b58 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 0000000000000..74e48ecd07cf3 --- /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 3073fff3650c1..bd44092f65a3f 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,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Storage Management Client. @@ -33,52 +32,60 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 3a99a334bf0b8..00c9b33ca7822 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 0000000000000..74e48ecd07cf3 --- /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 7b8955c523715..4171e0334612a 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 7faa9b1117b95..75df2fc0c534f 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 a7cb247a208aa..c3df4e2711b67 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models.py index 26863c8864f1f..73e991194f70f 100644 --- 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 @@ -42,6 +42,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -53,12 +55,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 = { @@ -74,6 +76,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -86,8 +96,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 @@ -108,6 +118,10 @@ def __init__( self, **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 = kwargs.get('services', None) @@ -117,9 +131,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. @@ -139,6 +153,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -147,8 +166,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 = { @@ -159,6 +178,10 @@ def __init__( self, **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 = kwargs.get('blob', None) @@ -196,6 +219,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -214,11 +239,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 = { @@ -239,6 +264,13 @@ def __init__( self, **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 @@ -254,10 +286,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 @@ -277,6 +309,12 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -293,11 +331,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". @@ -388,6 +426,13 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -412,8 +457,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 """ @@ -434,6 +479,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -443,31 +492,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 = { @@ -490,6 +539,33 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -530,6 +606,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -558,6 +636,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -583,6 +663,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -592,8 +674,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 = { @@ -608,6 +690,10 @@ def __init__( self, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = kwargs['key_name'] @@ -615,24 +701,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 = { @@ -647,6 +733,26 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -689,6 +795,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -699,8 +807,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 = { @@ -711,6 +819,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -740,6 +852,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/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_01_01/models/_models_py3.py index 955e9e189d805..7e4597826a133 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 654cb84a2f4d7..1b64707c39ee1 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 32e8240c59615..de3905950bfba 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,26 +5,358 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +379,7 @@ 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" @@ -58,7 +391,8 @@ 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 @@ -69,30 +403,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,8 +430,10 @@ 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 @@ -121,32 +447,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +478,11 @@ 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 @@ -187,15 +506,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 +530,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,8 +556,10 @@ 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 @@ -266,25 +585,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,6 +608,8 @@ 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 @@ -324,27 +637,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,8 +661,11 @@ 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 @@ -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] + + _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 @@ -434,8 +730,11 @@ 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 @@ -445,8 +744,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.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 +755,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,11 +795,13 @@ 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 @@ -516,8 +814,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.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 +825,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,11 +867,13 @@ 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 @@ -601,27 +899,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,8 +923,11 @@ 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 @@ -654,7 +945,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 +957,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 +986,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 12abbf330c1ee..99d0e2a8a9b44 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,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 +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/v2016_12_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/__init__.py index 82424ef131541..b1e55270b0610 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 3de31a8ecb13b..05d166582d847 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2016_12_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/_metadata.json index fd86d7ddbe844..a412131b35001 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 0000000000000..74e48ecd07cf3 --- /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 772ef59aa1154..5dd3f5f81ce2a 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,23 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagement(object): """The Azure Storage Management API. @@ -33,52 +32,60 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 5bd005704dd71..95bb9e0d6b2cd 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 b0594d0b4d23c..4530a7716a3ba 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 0000000000000..74e48ecd07cf3 --- /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 104386ad38fac..d21dcc2486664 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 c8d9d3971a37f..25d69d4d554ae 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 f86af2a945482..5b1a91f62142a 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models.py index ccb022c84cdaf..1c625d473c874 100644 --- 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 @@ -14,34 +14,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 = { @@ -66,6 +66,37 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -110,6 +141,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -121,12 +154,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 = { @@ -142,6 +175,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -154,8 +195,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 @@ -176,6 +217,10 @@ def __init__( self, **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 = kwargs.get('services', None) @@ -185,9 +230,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. @@ -207,6 +252,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -217,10 +267,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. @@ -243,6 +293,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -283,6 +339,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -311,6 +369,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -336,6 +396,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -351,11 +413,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 = { @@ -376,6 +438,13 @@ def __init__( self, **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 @@ -389,50 +458,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 = { @@ -466,6 +534,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs['resource'] @@ -494,10 +608,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 @@ -517,6 +631,12 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -533,11 +653,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". @@ -580,8 +700,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 = { @@ -631,6 +751,16 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -656,8 +786,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 """ @@ -678,6 +808,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -687,33 +821,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 = { @@ -737,6 +871,36 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -778,6 +942,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -806,6 +972,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -831,6 +999,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -840,8 +1010,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 = { @@ -856,6 +1026,10 @@ def __init__( self, **kwargs ): + """ + :keyword key_name: Required. + :paramtype key_name: str + """ super(StorageAccountRegenerateKeyParameters, self).__init__(**kwargs) self.key_name = kwargs['key_name'] @@ -863,26 +1037,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 = { @@ -898,6 +1072,29 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -941,6 +1138,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -951,8 +1150,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 = { @@ -963,6 +1162,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -992,6 +1195,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/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2016_12_01/models/_models_py3.py index 978707220a8d4..74fc9ef657db6 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 201fcb17b8b33..c59000b0d3cbb 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 5d6595502c7ef..4d43b5bd98639 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,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +459,7 @@ 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" @@ -58,7 +471,8 @@ 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 @@ -69,30 +483,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +510,10 @@ 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 @@ -121,32 +527,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +558,11 @@ 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 @@ -188,15 +587,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 +611,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,8 +637,10 @@ 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 @@ -268,25 +667,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,6 +690,8 @@ 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 @@ -327,27 +720,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,8 +744,11 @@ 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 @@ -399,32 +785,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +814,11 @@ 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 @@ -449,8 +828,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.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 +839,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,11 +879,13 @@ 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 @@ -521,8 +899,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 +910,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,11 +952,13 @@ 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 @@ -607,27 +985,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,8 +1009,11 @@ 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 @@ -661,7 +1032,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 +1044,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +1073,11 @@ 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 @@ -742,32 +1107,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] + + _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 @@ -781,8 +1136,11 @@ 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 @@ -812,32 +1170,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 +1199,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 41da5c54a5d18..417c28b8e6336 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,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 +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/v2017_06_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/__init__.py index 82424ef131541..b1e55270b0610 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 e7465ee4800aa..4f8aaaa252ba3 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2017_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/_metadata.json index 8824bfa844b9a..06ff3b25e9b76 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 0000000000000..74e48ecd07cf3 --- /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 7eeb5b97d7bf5..e357bb19f941a 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,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagement(object): """The Azure Storage Management API. @@ -39,56 +36,62 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 5bd005704dd71..95bb9e0d6b2cd 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 d1bce9a43917f..75423496d596d 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 0000000000000..74e48ecd07cf3 --- /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 6688603f8fc17..9db0180413604 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 efe606dcfaed2..2ab101b653bee 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 cc0aa50c9fe0a..2ee10b9cb7de3 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 64d32bee43d8a..c4deac3831325 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 f4a58fed75145..971abfc7f82cb 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_06_01/models/_models.py index d48a55e487cdc..2ba1c39778b76 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -107,6 +135,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -118,12 +148,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 = { @@ -139,6 +169,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -147,10 +185,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 = { @@ -162,6 +200,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -172,14 +216,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 = { @@ -196,6 +240,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -207,9 +261,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. @@ -229,6 +283,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -239,10 +298,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. @@ -265,6 +324,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -305,6 +370,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -345,6 +412,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -355,12 +424,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 = { @@ -376,6 +445,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -384,12 +461,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 = { @@ -402,6 +479,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -429,6 +514,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -454,6 +541,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -461,24 +550,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 = { @@ -497,6 +586,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -514,18 +623,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 = { @@ -543,6 +652,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -553,14 +677,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 = { @@ -574,6 +698,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -584,12 +718,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 = { @@ -602,6 +736,14 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -611,8 +753,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 = { @@ -623,6 +765,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -638,11 +784,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 = { @@ -663,6 +809,13 @@ def __init__( self, **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 @@ -681,11 +834,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 = { @@ -703,6 +856,13 @@ def __init__( self, **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 @@ -714,50 +874,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 = { @@ -791,6 +950,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs['resource'] @@ -815,8 +1020,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 = { @@ -827,6 +1033,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -838,10 +1049,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 @@ -856,9 +1067,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 = { @@ -884,6 +1095,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -920,6 +1140,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -936,17 +1158,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 @@ -985,8 +1207,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 """ @@ -1041,6 +1263,18 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -1068,8 +1302,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 @@ -1091,6 +1325,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1100,37 +1338,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 = { @@ -1156,6 +1394,40 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -1199,6 +1471,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1227,6 +1501,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1252,6 +1528,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1261,9 +1539,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 = { @@ -1278,6 +1556,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -1285,30 +1568,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 = { @@ -1326,6 +1609,33 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -1358,6 +1668,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -1396,6 +1708,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1406,8 +1720,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 = { @@ -1418,6 +1732,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1447,6 +1765,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -1457,15 +1777,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 = { @@ -1482,6 +1802,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 1fbc5e0de6649..27f9a8a68a2e5 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 126642341c466..f336ec50edb7a 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 c4e8c53feb58f..9e3ba8d3dbb2d 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 2878e851de874..abbb68b1ae740 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 ac8b8d149fcc1..a568f6f001225 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,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +459,7 @@ 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" @@ -58,7 +471,8 @@ 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 @@ -69,30 +483,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +510,10 @@ 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 @@ -121,32 +527,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +558,11 @@ 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 @@ -188,15 +587,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 +611,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,8 +637,10 @@ 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 @@ -268,25 +667,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,6 +690,8 @@ 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 @@ -327,27 +720,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,8 +744,11 @@ 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 @@ -399,32 +785,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +814,11 @@ 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 @@ -449,8 +828,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.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 +839,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,11 +879,13 @@ 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 @@ -521,8 +899,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 +910,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,11 +952,13 @@ 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 @@ -607,27 +985,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,8 +1009,11 @@ 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 @@ -661,7 +1032,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 +1044,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +1073,11 @@ 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 @@ -742,32 +1107,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] + + _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 @@ -781,8 +1136,11 @@ 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 @@ -812,32 +1170,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 +1199,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 b8e9bd93da758..3844878c5376c 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,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 +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/v2017_10_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/__init__.py index 82424ef131541..b1e55270b0610 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 edf1c4ec007f0..a9ef35893b20f 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2017_10_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/_metadata.json index 3c75ea3f9f472..18c4818d73bba 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 0000000000000..74e48ecd07cf3 --- /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 ac56af6466054..b47d23d32f617 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,25 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagement(object): """The Azure Storage Management API. @@ -39,56 +36,62 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 5bd005704dd71..95bb9e0d6b2cd 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 bc7317fc2de9c..62905b5cff39f 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 0000000000000..74e48ecd07cf3 --- /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 b757fd32416f1..6a82295fa58a6 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 b4c1535f7db23..7564699777bd7 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 da4d4780c46d6..54a0cee61607e 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 f7436de7de952..34137157cf88a 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 7675582d36965..b0568aa54af2d 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2017_10_01/models/_models.py index 247337f032dbe..ddf135c404fc9 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -107,6 +135,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -118,12 +148,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 = { @@ -139,6 +169,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -147,10 +185,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 = { @@ -162,6 +200,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -172,14 +216,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 = { @@ -196,6 +240,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -207,9 +261,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. @@ -229,6 +283,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -239,10 +298,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. @@ -265,6 +324,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -305,6 +370,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -345,6 +412,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -355,12 +424,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 = { @@ -376,6 +445,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -384,12 +461,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 = { @@ -402,6 +479,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -429,6 +514,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -454,6 +541,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -461,24 +550,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 = { @@ -497,6 +586,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -514,18 +623,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 = { @@ -543,6 +652,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -553,14 +677,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 = { @@ -574,6 +698,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -584,12 +718,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 = { @@ -602,6 +736,14 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -611,8 +753,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 = { @@ -623,6 +765,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -638,11 +784,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 = { @@ -663,6 +809,13 @@ def __init__( self, **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 @@ -681,11 +834,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 = { @@ -703,6 +856,13 @@ def __init__( self, **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 @@ -714,50 +874,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 = { @@ -791,6 +950,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs['resource'] @@ -815,8 +1020,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 = { @@ -827,6 +1033,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -838,10 +1049,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 @@ -856,9 +1067,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 = { @@ -884,6 +1095,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -920,6 +1140,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -936,17 +1158,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 @@ -985,8 +1207,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 """ @@ -1041,6 +1263,18 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -1068,8 +1302,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 @@ -1091,6 +1325,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1100,37 +1338,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 = { @@ -1156,6 +1394,40 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -1199,6 +1471,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1227,6 +1501,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1252,6 +1528,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1261,9 +1539,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 = { @@ -1278,6 +1556,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -1285,33 +1568,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 = { @@ -1330,6 +1613,36 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -1363,6 +1676,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -1401,6 +1716,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -1411,8 +1728,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 = { @@ -1423,6 +1740,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1452,6 +1773,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -1462,15 +1785,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 = { @@ -1487,6 +1810,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 a7523b679d831..4e51bdf007ea0 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 83fdca35bb849..d02bb1744c31a 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 dd286793eb483..edf63b8dc691e 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 26d4f4ee98432..775fcd6915b5b 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 62a52a1945c51..abe7870a2aed5 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,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +459,7 @@ 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" @@ -58,7 +471,8 @@ 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 @@ -69,30 +483,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +510,10 @@ 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 @@ -121,32 +527,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +558,11 @@ 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 @@ -188,15 +587,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 +611,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,8 +637,10 @@ 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 @@ -268,25 +667,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,6 +690,8 @@ 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 @@ -327,27 +720,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,8 +744,11 @@ 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 @@ -399,32 +785,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +814,11 @@ 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 @@ -449,8 +828,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.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 +839,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,11 +879,13 @@ 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 @@ -521,8 +899,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 +910,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,11 +952,13 @@ 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 @@ -607,27 +985,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,8 +1009,11 @@ 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 @@ -661,7 +1032,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 +1044,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +1073,11 @@ 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 @@ -742,32 +1107,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] + + _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 @@ -781,8 +1136,11 @@ 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 @@ -812,32 +1170,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 +1199,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 e332398eda319..424c127058c0c 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +103,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 +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_02_01/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/__init__.py index a50d1e1c39a72..1072dc1031610 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 18b98ce504fa2..c596f728b39b3 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2018_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/_metadata.json index a2c24b4895f48..139aa781ea207 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 0000000000000..74e48ecd07cf3 --- /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 068f4c223601d..450c9aa0e95ae 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,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -44,56 +40,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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 2b4668fe15490..4753ba582e4f2 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 0000000000000..74e48ecd07cf3 --- /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 5212691cddec1..362dd69b698c0 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 0745b0e446301..f48caaa521362 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 afacadb61fae7..14ccad1fdee12 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 a8133bca91ddf..449ca6e2634c3 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 0842a3a0d05c8..fac93bbe74ee8 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 d04e257ee6de8..525d91eb16e8f 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_02_01/models/_models.py index 8876aeaf99880..0f9f301f551f3 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -105,6 +133,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -146,6 +176,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -165,9 +197,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", @@ -179,8 +211,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 @@ -233,6 +265,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -279,6 +318,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -290,12 +331,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 = { @@ -311,6 +352,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -319,10 +368,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 = { @@ -334,6 +383,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -344,14 +399,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 = { @@ -368,6 +423,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -379,9 +444,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. @@ -401,6 +466,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -411,10 +481,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. @@ -437,6 +507,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -485,6 +561,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -527,6 +605,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -549,9 +629,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 @@ -579,6 +659,11 @@ def __init__( self, **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 = kwargs['immutability_period_since_creation_in_days'] self.state = None @@ -593,9 +678,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 @@ -618,6 +703,11 @@ def __init__( self, **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 @@ -630,12 +720,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 = { @@ -651,6 +741,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -659,12 +757,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 = { @@ -677,6 +775,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -688,20 +794,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 = { @@ -720,6 +826,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -731,11 +853,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 = { @@ -747,6 +869,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -764,9 +893,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 = { @@ -783,6 +912,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -798,8 +932,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 = { @@ -815,6 +949,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -841,6 +979,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -860,9 +1000,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", @@ -874,8 +1014,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 @@ -928,6 +1068,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -944,8 +1091,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 = { @@ -956,6 +1103,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -981,6 +1132,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -988,24 +1141,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 = { @@ -1024,6 +1177,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1041,18 +1214,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 = { @@ -1070,6 +1243,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -1080,14 +1268,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 = { @@ -1101,6 +1289,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1111,14 +1309,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 = { @@ -1132,6 +1330,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1142,8 +1350,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 = { @@ -1154,6 +1362,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1168,11 +1380,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 = { @@ -1190,6 +1402,13 @@ def __init__( self, **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 @@ -1201,49 +1420,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 = { @@ -1276,6 +1494,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -1300,8 +1564,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 = { @@ -1312,6 +1577,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -1323,10 +1593,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 @@ -1341,9 +1611,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 = { @@ -1369,6 +1639,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -1405,6 +1684,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1425,10 +1706,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 = { @@ -1450,6 +1731,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -1470,16 +1757,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 @@ -1518,12 +1805,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 = { @@ -1578,6 +1865,19 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -1606,8 +1906,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 @@ -1629,6 +1929,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1638,39 +1942,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 = { @@ -1697,6 +2001,42 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -1741,6 +2081,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1769,6 +2111,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1794,6 +2138,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1803,9 +2149,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 = { @@ -1820,6 +2166,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -1827,33 +2178,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 = { @@ -1872,6 +2223,36 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -1905,6 +2286,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -1946,6 +2329,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -1998,6 +2383,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2041,6 +2428,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2051,8 +2440,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 = { @@ -2063,6 +2452,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2092,6 +2485,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2102,15 +2497,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 = { @@ -2127,6 +2522,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 479bf8bb2d31a..4504b68494487 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 2909ae5a6bedb..88318ccb431bf 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 30be846f0a807..aaac0d7337044 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,23 +5,566 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,6 +587,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,27 +615,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +639,11 @@ 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 @@ -144,33 +681,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -184,8 +711,11 @@ 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 @@ -222,33 +752,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -262,8 +782,11 @@ 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 @@ -296,28 +819,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,8 +844,11 @@ 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 @@ -365,26 +881,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,6 +905,8 @@ 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 @@ -434,33 +944,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,8 +974,11 @@ 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 @@ -512,33 +1015,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,8 +1045,11 @@ 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 @@ -596,40 +1092,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,14 +1122,18 @@ 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 @@ -685,32 +1172,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,14 +1194,18 @@ 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 @@ -768,31 +1246,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,14 +1268,18 @@ 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 @@ -848,29 +1318,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,14 +1340,18 @@ 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 @@ -931,37 +1395,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,14 +1425,18 @@ 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 @@ -1015,36 +1473,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 +1506,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 f35f77e881ea0..3dccb4e9bbfe1 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 effa8fb43cc91..6fed96d46ed9d 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 8607e3345db0b..08699ae4b5fd2 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,26 +5,438 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +459,7 @@ 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" @@ -58,7 +471,8 @@ 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 @@ -69,30 +483,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +510,10 @@ 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 @@ -121,32 +527,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +558,11 @@ 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 @@ -188,15 +587,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 +611,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,8 +637,10 @@ 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 @@ -268,25 +667,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,6 +690,8 @@ 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 @@ -327,27 +720,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,8 +744,11 @@ 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 @@ -399,32 +785,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +814,11 @@ 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 @@ -449,8 +828,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.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 +839,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,11 +879,13 @@ 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 @@ -521,8 +899,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 +910,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,11 +952,13 @@ 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 @@ -607,27 +985,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,8 +1009,11 @@ 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 @@ -661,7 +1032,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 +1044,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +1073,11 @@ 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 @@ -742,32 +1107,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] + + _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 @@ -781,8 +1136,11 @@ 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 @@ -812,32 +1170,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 +1199,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 fad16b17f7c2e..5c39589a83e4a 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,24 +5,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsageOperations(object): """UsageOperations operations. @@ -45,6 +119,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -62,34 +137,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,11 +177,13 @@ 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 @@ -133,35 +205,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 +247,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 a50d1e1c39a72..1072dc1031610 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 34de4aa030175..0fe8435c07af7 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2018_03_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/_metadata.json index f43ef6f0e135e..57bd56d7a8304 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 0000000000000..74e48ecd07cf3 --- /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 cfc02e2a148af..eab68b7638a13 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,26 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -35,65 +31,71 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 c63a8a0b88b0e..edeb9aee8f38e 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 0000000000000..74e48ecd07cf3 --- /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 9e79123232e84..ba2dcab1ef40b 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 cbbc78a23b4d6..38ff461e4a91a 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 f16fcc74108e5..5f78fa9d0ca53 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 78e9436d07d3b..aaa32108fdd7a 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 798a72a41dd5f..c80f2ac5904a1 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 af7951014e4d9..dfecb552b8814 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_03_01_preview/models/_models.py index 3317718d039cd..b760127672b5d 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +64,35 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -105,6 +135,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -146,6 +178,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -165,9 +199,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", @@ -179,8 +213,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 @@ -233,6 +267,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -279,6 +320,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -290,12 +333,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 = { @@ -311,6 +354,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -319,10 +370,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 = { @@ -334,6 +385,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -344,14 +401,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 = { @@ -368,6 +426,17 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -379,9 +448,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. @@ -401,6 +470,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -411,10 +485,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. @@ -437,6 +511,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -485,6 +565,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -527,6 +609,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -549,9 +633,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 @@ -579,6 +663,11 @@ def __init__( self, **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 = kwargs['immutability_period_since_creation_in_days'] self.state = None @@ -594,9 +683,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 @@ -619,6 +708,11 @@ def __init__( self, **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 @@ -631,12 +725,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 = { @@ -652,6 +746,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -660,12 +762,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 = { @@ -678,6 +780,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -689,20 +799,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 = { @@ -721,6 +832,23 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -732,11 +860,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 = { @@ -748,6 +876,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -765,9 +900,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 = { @@ -784,6 +919,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -799,8 +939,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 = { @@ -816,6 +956,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -842,6 +986,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -861,9 +1007,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", @@ -875,8 +1021,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 @@ -929,6 +1075,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -945,8 +1098,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 = { @@ -957,6 +1110,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -982,6 +1139,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -989,9 +1148,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 = { @@ -1002,6 +1161,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1009,9 +1173,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 = { @@ -1022,6 +1186,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1029,24 +1198,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 = { @@ -1065,6 +1234,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1082,19 +1271,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 = { @@ -1112,6 +1301,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -1122,14 +1326,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 """ @@ -1144,6 +1348,17 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1154,14 +1369,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 = { @@ -1175,6 +1390,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1185,8 +1410,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 = { @@ -1197,6 +1422,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1211,11 +1440,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 = { @@ -1233,6 +1462,13 @@ def __init__( self, **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 @@ -1244,49 +1480,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 = { @@ -1319,6 +1554,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -1343,8 +1624,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] """ @@ -1356,6 +1637,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -1367,10 +1653,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 @@ -1385,9 +1671,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 = { @@ -1413,6 +1699,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -1449,6 +1744,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1469,10 +1766,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 = { @@ -1494,6 +1791,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -1514,16 +1817,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 @@ -1564,12 +1867,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 = { @@ -1624,6 +1927,19 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -1652,8 +1968,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 @@ -1675,6 +1991,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1684,39 +2004,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 = { @@ -1743,6 +2063,42 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -1787,6 +2143,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -1815,6 +2173,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -1840,6 +2200,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -1857,9 +2219,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 """ @@ -1883,6 +2245,11 @@ def __init__( self, **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 = kwargs.get('policy', None) self.last_modified_time = None @@ -1893,9 +2260,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 """ @@ -1913,6 +2280,11 @@ def __init__( self, **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__(**kwargs) self.last_modified_time = None @@ -1922,9 +2294,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 = { @@ -1939,6 +2311,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -1946,33 +2323,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 = { @@ -1991,6 +2368,36 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -2024,6 +2431,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2065,6 +2474,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2118,6 +2529,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2161,6 +2574,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2171,8 +2586,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 = { @@ -2183,6 +2598,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2212,6 +2631,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2222,15 +2643,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 = { @@ -2247,6 +2668,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 d0bed1a066311..1617b93056d40 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 12b17087101a3..3b47b1533b08b 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 c2b617cc213df..1babc5d2ee56b 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,23 +5,566 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,6 +587,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,27 +615,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +639,11 @@ 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 @@ -144,33 +681,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -184,8 +711,11 @@ 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 @@ -222,33 +752,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -262,8 +782,11 @@ 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 @@ -296,28 +819,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,8 +844,11 @@ 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 @@ -365,26 +881,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,6 +905,8 @@ 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 @@ -434,33 +944,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,8 +974,11 @@ 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 @@ -512,33 +1015,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,8 +1045,11 @@ 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 @@ -596,40 +1092,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,14 +1122,18 @@ 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 @@ -685,32 +1172,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,14 +1194,18 @@ 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 @@ -768,31 +1246,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,14 +1268,18 @@ 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 @@ -848,29 +1318,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,14 +1340,18 @@ 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 @@ -931,37 +1395,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,14 +1425,18 @@ 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 @@ -1015,36 +1473,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 +1506,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 6d68c52723b47..d5293123939eb 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 fd75156fc7f6a..97dfe93f0c141 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 37821a6431a65..29616eb5123e3 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,26 +5,550 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_management_policies_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_management_policies_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +571,7 @@ 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" @@ -58,7 +583,8 @@ 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 @@ -69,30 +595,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,8 +622,10 @@ 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 @@ -121,32 +639,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +670,11 @@ 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 @@ -188,15 +699,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 +724,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,8 +750,10 @@ 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 @@ -268,25 +780,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,6 +803,8 @@ 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 @@ -327,27 +833,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,8 +857,11 @@ 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 @@ -399,32 +898,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] + + _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,8 +927,11 @@ 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 @@ -449,8 +941,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.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 +952,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,11 +992,13 @@ 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 @@ -521,8 +1012,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 +1023,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,11 +1065,13 @@ 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 @@ -607,27 +1098,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,8 +1122,11 @@ 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 @@ -661,7 +1145,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 +1157,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] + + _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,8 +1186,11 @@ 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 @@ -742,32 +1220,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,8 +1249,11 @@ 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 @@ -812,32 +1283,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,8 +1312,11 @@ 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 @@ -872,7 +1336,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 +1348,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,8 +1373,11 @@ 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 @@ -940,9 +1398,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 +1413,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,8 +1443,11 @@ 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 @@ -1014,7 +1467,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 +1479,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 +1502,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 e2cfb72fccde2..2b0b3e0a94b60 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,24 +5,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +119,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +129,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.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 +138,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,11 +178,13 @@ 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 @@ -125,7 +198,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 +207,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 +249,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 a50d1e1c39a72..1072dc1031610 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 f3d8366b82778..127cc002980b7 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +67,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 a1c7fee4efe7b..7f3524dbdbe59 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 0000000000000..74e48ecd07cf3 --- /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 becb08726f0dd..a34aafc038644 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,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -45,65 +39,68 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 60a2a379f1125..fe4c525e94d1b 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 0000000000000..74e48ecd07cf3 --- /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 5f5960a05e5f7..b76300387370c 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 fa446262595e3..aa84be944156d 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 fc13dc5fd68da..bb77d1ea4a292 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 57e4c676eebc2..8199f2dd6d7a9 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 8f374fe943878..32cf2b7045833 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 a79667a988624..61360cf1c6dce 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 4ec8dc6ea00f0..3895931d3a31c 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 b6dc43fd93281..08c9560de9ad9 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_07_01/models/_models.py index ea1e6fc66306a..84d10a47b327e 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -105,6 +133,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -146,6 +176,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -165,9 +197,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", @@ -179,8 +211,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 @@ -233,6 +265,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -259,16 +298,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 = { @@ -290,6 +329,19 @@ def __init__( self, **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 = kwargs.get('cors', None) self.default_service_version = kwargs.get('default_service_version', None) @@ -329,6 +381,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -340,22 +394,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 = { @@ -378,6 +432,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -389,9 +461,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 = { @@ -402,6 +474,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -411,12 +488,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 = { @@ -432,6 +509,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -440,11 +525,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 = { @@ -460,6 +545,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -468,10 +560,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 = { @@ -483,6 +575,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -493,14 +591,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 = { @@ -517,6 +615,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -528,9 +636,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. @@ -550,6 +658,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -560,10 +673,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. @@ -586,6 +699,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -634,6 +753,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -681,6 +802,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -720,6 +843,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -742,9 +867,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 @@ -772,6 +897,11 @@ def __init__( self, **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 = kwargs['immutability_period_since_creation_in_days'] self.state = None @@ -786,9 +916,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 @@ -811,6 +941,11 @@ def __init__( self, **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 @@ -823,12 +958,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 = { @@ -844,6 +979,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -852,12 +995,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 = { @@ -870,6 +1013,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -881,20 +1032,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 = { @@ -913,6 +1064,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -924,11 +1091,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 = { @@ -940,6 +1107,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -957,9 +1131,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 = { @@ -976,6 +1150,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -991,8 +1170,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 = { @@ -1008,6 +1187,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -1034,6 +1217,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1053,9 +1238,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", @@ -1067,8 +1252,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 @@ -1121,6 +1306,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -1137,8 +1329,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 = { @@ -1149,6 +1341,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1174,6 +1370,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1181,9 +1379,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 = { @@ -1194,6 +1392,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1201,9 +1404,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 = { @@ -1214,6 +1417,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1221,24 +1429,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 = { @@ -1257,6 +1465,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1274,18 +1502,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 = { @@ -1303,6 +1531,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -1313,14 +1556,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 = { @@ -1334,6 +1577,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1344,14 +1597,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 = { @@ -1365,6 +1618,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1375,8 +1638,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 = { @@ -1387,6 +1650,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1401,11 +1668,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 = { @@ -1423,6 +1690,13 @@ def __init__( self, **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 @@ -1434,49 +1708,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 = { @@ -1509,6 +1782,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -1533,8 +1852,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 = { @@ -1545,6 +1865,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -1556,10 +1881,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 @@ -1574,9 +1899,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 = { @@ -1602,6 +1927,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -1638,6 +1972,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1658,10 +1994,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 = { @@ -1683,6 +2019,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -1703,17 +2045,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 @@ -1752,15 +2094,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, @@ -1825,6 +2167,22 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -1856,8 +2214,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 @@ -1879,6 +2237,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -1888,42 +2250,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 = { @@ -1951,6 +2313,45 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -1996,6 +2397,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2024,6 +2427,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2049,6 +2454,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -2066,9 +2473,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 """ @@ -2092,6 +2499,11 @@ def __init__( self, **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 = kwargs.get('policy', None) self.last_modified_time = None @@ -2102,9 +2514,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 """ @@ -2122,6 +2534,11 @@ def __init__( self, **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__(**kwargs) self.last_modified_time = None @@ -2131,9 +2548,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 = { @@ -2148,6 +2565,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -2155,38 +2577,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 = { @@ -2206,6 +2627,41 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -2240,6 +2696,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2281,6 +2739,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2333,6 +2793,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2376,6 +2838,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2386,8 +2850,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 = { @@ -2398,6 +2862,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2427,6 +2895,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2437,15 +2907,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 = { @@ -2462,6 +2932,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 6131ef6b95809..faa5d60322eb4 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 fa211fdcfb1fe..f9d371f333e0a 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 7b82675960098..19836418feebf 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,23 +5,566 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,6 +587,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,27 +615,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +639,11 @@ 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 @@ -144,33 +681,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -184,8 +711,11 @@ 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 @@ -222,33 +752,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -262,8 +782,11 @@ 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 @@ -296,28 +819,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,8 +844,11 @@ 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 @@ -365,26 +881,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,6 +905,8 @@ 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 @@ -434,33 +944,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,8 +974,11 @@ 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 @@ -512,33 +1015,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,8 +1045,11 @@ 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 @@ -596,40 +1092,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,14 +1122,18 @@ 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 @@ -685,32 +1172,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,14 +1194,18 @@ 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 @@ -768,31 +1246,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,14 +1268,18 @@ 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 @@ -848,29 +1318,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,14 +1340,18 @@ 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 @@ -931,37 +1395,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,14 +1425,18 @@ 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 @@ -1015,36 +1473,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 +1506,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 e8ff35acfd3ef..646aa49e4309f 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,23 +5,111 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_set_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -44,6 +132,7 @@ 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 @@ -75,34 +164,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] + + _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 @@ -116,8 +193,11 @@ 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 @@ -145,29 +225,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 +249,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 44421d592324b..c069af13e390d 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 934ea1a3c3096..96d6036e54b8a 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 6ec7114820dae..2519895ee8908 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 d0027934c4067..7451a0cb27c8e 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,26 +5,472 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "geoReplicationStats") # 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') + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +493,7 @@ 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" @@ -58,7 +505,8 @@ 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 @@ -69,30 +517,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,8 +544,10 @@ 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 @@ -121,32 +561,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +592,11 @@ 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 @@ -188,15 +621,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 +645,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,8 +671,10 @@ 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 @@ -268,25 +701,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,6 +724,8 @@ 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 @@ -320,6 +747,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 +759,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,8 +784,11 @@ 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 @@ -405,32 +825,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] + + _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,8 +854,11 @@ 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 @@ -455,8 +868,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.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 +879,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,11 +919,13 @@ 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 @@ -527,8 +939,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 +950,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,11 +992,13 @@ 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 @@ -613,27 +1025,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,8 +1049,11 @@ 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 @@ -667,7 +1072,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 +1084,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -717,8 +1113,11 @@ 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 @@ -748,32 +1147,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,8 +1176,11 @@ 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 @@ -818,32 +1210,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,8 +1239,10 @@ 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 @@ -871,25 +1255,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -902,6 +1278,8 @@ 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 @@ -922,15 +1300,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 +1324,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 +1343,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 f0811efef51dd..b74efbf49c63e 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 ae1189ceb9e3a..319967b1067e2 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2018_11_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/_metadata.json index 8976f08b5bfad..da90b392297c0 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 0000000000000..74e48ecd07cf3 --- /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 0174a08f351af..65038d34817d6 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,28 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -41,7 +35,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 +45,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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 b03b3914c9356..46883bec2cf5c 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 0000000000000..74e48ecd07cf3 --- /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 09deca61e2adb..dfcd9c84d5f2a 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 1940f65d2beaa..20354f48e01d3 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 7562fad33ec9f..10a61fd2e118d 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 b06335bcadfc4..557bbd26ac15e 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 7ddde1f8e9e94..9f26fc42e81d8 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 157f14924a9df..96993efcddcf5 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 6db372da1d6d0..b50f8b6b2f8b5 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 f5f99b4e06cf1..457c302cca05c 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2018_11_01/models/_models.py index f85be8e03a012..c3d5e44605898 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -105,6 +133,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -146,6 +176,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -165,9 +197,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", @@ -179,8 +211,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 @@ -233,6 +265,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -259,16 +298,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 = { @@ -290,6 +329,19 @@ def __init__( self, **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 = kwargs.get('cors', None) self.default_service_version = kwargs.get('default_service_version', None) @@ -329,6 +381,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -340,22 +394,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 = { @@ -378,6 +432,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -389,9 +461,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 = { @@ -402,6 +474,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -411,12 +488,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 = { @@ -432,6 +509,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -442,9 +527,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 = { @@ -459,6 +544,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -468,9 +558,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 = { @@ -485,6 +575,11 @@ def __init__( self, **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 = kwargs['days_after_modification_greater_than'] @@ -492,11 +587,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 = { @@ -512,6 +607,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -520,10 +622,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 = { @@ -535,6 +637,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -545,14 +653,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 = { @@ -569,6 +677,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -580,9 +698,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. @@ -602,6 +720,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -612,10 +735,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. @@ -638,6 +761,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -686,6 +815,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -733,6 +864,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -772,6 +905,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -794,9 +929,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 @@ -824,6 +959,11 @@ def __init__( self, **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 = kwargs['immutability_period_since_creation_in_days'] self.state = None @@ -838,9 +978,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 @@ -863,6 +1003,11 @@ def __init__( self, **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 @@ -875,12 +1020,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 = { @@ -896,6 +1041,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -904,12 +1057,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 = { @@ -922,6 +1075,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -933,20 +1094,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 = { @@ -965,6 +1126,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -976,11 +1153,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 = { @@ -992,6 +1169,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -1009,9 +1193,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 = { @@ -1028,6 +1212,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -1043,8 +1232,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 = { @@ -1060,6 +1249,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -1086,6 +1279,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1105,9 +1300,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", @@ -1119,8 +1314,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 @@ -1173,6 +1368,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -1189,8 +1391,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 = { @@ -1201,6 +1403,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1226,6 +1432,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1245,9 +1453,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 = { @@ -1269,6 +1477,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1277,10 +1490,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 = { @@ -1292,6 +1505,12 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -1300,14 +1519,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 = { @@ -1320,6 +1539,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -1331,10 +1560,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 = { @@ -1350,6 +1579,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -1360,10 +1595,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 = { @@ -1379,6 +1614,12 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -1389,15 +1630,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 = { @@ -1417,6 +1658,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -1429,9 +1681,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 = { @@ -1446,6 +1698,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -1453,8 +1710,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 = { @@ -1465,6 +1722,10 @@ def __init__( self, **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 = kwargs.get('delete', None) @@ -1472,24 +1733,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 = { @@ -1508,6 +1769,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1525,18 +1806,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 = { @@ -1554,6 +1835,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -1564,14 +1860,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 = { @@ -1585,6 +1881,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1595,14 +1901,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 = { @@ -1616,6 +1922,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -1626,8 +1942,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 = { @@ -1638,6 +1954,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -1652,11 +1972,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 = { @@ -1674,6 +1994,13 @@ def __init__( self, **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 @@ -1685,49 +2012,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 = { @@ -1760,6 +2086,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -1784,8 +2156,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 = { @@ -1796,6 +2169,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -1807,10 +2185,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 @@ -1825,9 +2203,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 = { @@ -1853,6 +2231,15 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -1889,6 +2276,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -1909,10 +2298,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 = { @@ -1934,6 +2323,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -1954,17 +2349,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 @@ -2003,15 +2398,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, @@ -2076,6 +2471,22 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -2107,8 +2518,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 @@ -2130,6 +2541,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -2139,42 +2554,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 = { @@ -2202,6 +2617,45 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -2247,6 +2701,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2275,6 +2731,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2300,6 +2758,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None @@ -2309,9 +2769,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 = { @@ -2326,6 +2786,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -2333,38 +2798,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 = { @@ -2384,6 +2848,41 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -2418,6 +2917,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2459,6 +2960,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2511,6 +3014,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -2554,6 +3059,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -2564,8 +3071,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 = { @@ -2576,6 +3083,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2605,6 +3116,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -2615,15 +3128,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 = { @@ -2640,6 +3153,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 bf89657db351c..f60fbdc8f96b3 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 d3fb4b16cb771..f4520a5730d45 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 a15dc4ad3d455..14c2cabcb5366 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,23 +5,566 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -44,6 +587,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,27 +615,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -105,8 +639,11 @@ 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 @@ -144,33 +681,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -188,8 +715,11 @@ 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 @@ -226,33 +756,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -266,8 +786,11 @@ 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 @@ -300,28 +823,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,8 +848,11 @@ 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 @@ -369,26 +885,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,6 +909,8 @@ 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 @@ -438,33 +948,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,8 +978,11 @@ 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 @@ -516,33 +1019,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,8 +1049,11 @@ 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 @@ -600,40 +1096,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,14 +1126,18 @@ 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 @@ -689,32 +1176,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,14 +1198,18 @@ 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 @@ -772,31 +1250,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,14 +1272,18 @@ 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 @@ -852,29 +1322,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,14 +1344,18 @@ 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 @@ -935,37 +1399,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,14 +1429,18 @@ 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 @@ -1019,36 +1477,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 +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_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 b70b3b64a36b8..9a6d4455d7182 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,23 +5,111 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_set_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -44,6 +132,7 @@ 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 @@ -75,34 +164,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] + + _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 @@ -116,8 +193,11 @@ 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 @@ -145,29 +225,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 +249,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 94ab07e919d95..810450e4d52ca 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 f175b84def049..f0badf5f1b3bd 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 84cf8529abd89..b81425a5c3ff2 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 a4ec5619f98f5..646f177e6cd18 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,26 +5,502 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "geoReplicationStats") # 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') + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +523,7 @@ 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" @@ -58,7 +535,8 @@ 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 @@ -69,30 +547,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,8 +574,10 @@ 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 @@ -121,32 +591,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +622,11 @@ 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 @@ -188,15 +651,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 +675,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,8 +701,10 @@ 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 @@ -268,25 +731,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,6 +754,8 @@ 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 @@ -320,6 +777,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 +789,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,8 +814,11 @@ 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 @@ -405,32 +855,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +884,11 @@ 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 @@ -455,8 +898,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.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 +909,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,11 +949,13 @@ 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 @@ -527,8 +969,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 +980,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,11 +1022,13 @@ 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 @@ -613,27 +1055,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,8 +1079,11 @@ 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 @@ -667,7 +1102,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 +1114,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -717,8 +1143,11 @@ 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 @@ -748,32 +1177,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +1206,11 @@ 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 @@ -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] + + _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 @@ -857,8 +1269,10 @@ 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 @@ -871,25 +1285,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -902,6 +1308,8 @@ 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 @@ -922,15 +1330,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 +1354,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,8 +1373,10 @@ 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 @@ -998,25 +1403,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 +1425,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 cc7aa7866b9c3..877661d42969b 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 9b6b24188f5b1..a644ea85e636e 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2019_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/_metadata.json index f9d6e88fcd3af..6e4b0d7dd7e19 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 0000000000000..74e48ecd07cf3 --- /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 19be09e6d40cb..245d0b7f2a060 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,30 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -43,7 +35,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 +49,64 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 e634518a9bf0c..9b0baac5d7cd9 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 0000000000000..74e48ecd07cf3 --- /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 9c1e69ebb08bf..d2bb1d9cf954b 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 8e2b43d5b6a93..df92bd141852c 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 96d7966352d69..9b9a19b387138 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 b7aaf2ea25847..a87dce3a231ba 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 0e341fb080e81..cdb1f4575bba4 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 9589da58dbde6..1c282345d7c38 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 03dfdc2e6bd97..8cc150105969d 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 f9f5d92a97dc6..260d736d83bda 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 b401f6df462d3..7991466668f95 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 f962a6c9f6f12..5b337768b0662 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py index e743f1ef8fcb9..c5d734fc67517 100644 --- 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 @@ -14,31 +14,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 = { @@ -63,6 +63,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -79,19 +107,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 = { @@ -116,6 +144,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -156,6 +200,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -197,6 +243,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -206,12 +254,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 """ @@ -228,6 +276,15 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -248,9 +305,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", @@ -262,8 +319,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 @@ -316,6 +373,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -350,6 +414,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -367,20 +433,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 = { @@ -404,6 +470,23 @@ def __init__( self, **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 = kwargs.get('cors', None) self.default_service_version = kwargs.get('default_service_version', None) @@ -415,8 +498,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 = { @@ -427,6 +510,10 @@ def __init__( self, **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 = kwargs.get('enabled', None) @@ -464,6 +551,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -473,17 +562,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 = { @@ -497,6 +586,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -509,22 +611,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 = { @@ -547,6 +649,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -558,9 +678,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 = { @@ -571,6 +691,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -580,12 +705,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 = { @@ -601,6 +726,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -611,9 +744,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 = { @@ -628,6 +761,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -637,9 +775,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 = { @@ -654,6 +792,11 @@ def __init__( self, **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 = kwargs['days_after_modification_greater_than'] @@ -661,11 +804,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 = { @@ -681,6 +824,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -689,10 +839,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 = { @@ -704,6 +854,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -714,14 +870,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 = { @@ -738,6 +894,16 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -749,9 +915,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. @@ -771,6 +937,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -781,10 +952,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. @@ -807,6 +978,12 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -855,6 +1032,8 @@ def __init__( self, **kwargs ): + """ + """ super(Endpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -885,6 +1064,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -902,10 +1083,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 = { @@ -925,6 +1106,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -946,11 +1133,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 = { @@ -976,6 +1163,13 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -999,11 +1193,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 = { @@ -1029,6 +1223,13 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1061,6 +1262,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1104,6 +1307,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -1143,6 +1348,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1165,9 +1372,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 @@ -1195,6 +1402,11 @@ def __init__( self, **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 = kwargs['immutability_period_since_creation_in_days'] self.state = None @@ -1209,9 +1421,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 @@ -1234,6 +1446,11 @@ def __init__( self, **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 @@ -1246,12 +1463,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 = { @@ -1267,6 +1484,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -1275,12 +1500,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 = { @@ -1293,6 +1518,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -1304,20 +1537,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 = { @@ -1336,6 +1569,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -1347,11 +1596,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 = { @@ -1363,6 +1612,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -1380,9 +1636,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 = { @@ -1399,6 +1655,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -1414,8 +1675,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 = { @@ -1431,6 +1692,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -1457,6 +1722,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -1476,9 +1743,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", @@ -1490,8 +1757,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 @@ -1544,6 +1811,13 @@ def __init__( self, **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 = kwargs.get('public_access', None) self.last_modified_time = None @@ -1583,6 +1857,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1609,6 +1885,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -1628,9 +1906,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 = { @@ -1652,6 +1930,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -1660,10 +1943,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 = { @@ -1675,6 +1958,12 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -1683,14 +1972,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 = { @@ -1703,6 +1992,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -1714,10 +2013,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 = { @@ -1733,6 +2032,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -1743,10 +2048,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 = { @@ -1762,6 +2067,12 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -1772,15 +2083,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 = { @@ -1800,6 +2111,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -1812,9 +2134,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 = { @@ -1829,6 +2151,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -1836,8 +2163,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 = { @@ -1848,6 +2175,10 @@ def __init__( self, **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 = kwargs.get('delete', None) @@ -1855,24 +2186,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 = { @@ -1891,6 +2222,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1908,18 +2259,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 = { @@ -1937,6 +2288,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -1947,14 +2313,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 = { @@ -1968,6 +2334,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -1978,14 +2354,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 = { @@ -1999,6 +2375,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -2009,8 +2395,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 = { @@ -2021,6 +2407,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2035,11 +2425,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 = { @@ -2057,6 +2447,13 @@ def __init__( self, **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 @@ -2068,49 +2465,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 = { @@ -2143,6 +2539,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -2167,8 +2609,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 = { @@ -2179,6 +2622,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -2190,11 +2638,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 @@ -2209,9 +2657,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 = { @@ -2237,6 +2685,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -2273,6 +2731,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -2293,10 +2753,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 = { @@ -2318,6 +2778,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -2338,17 +2804,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 @@ -2387,37 +2853,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 = { @@ -2481,6 +2947,39 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -2516,8 +3015,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 @@ -2539,6 +3038,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -2548,60 +3051,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 = { @@ -2633,6 +3136,62 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -2682,6 +3241,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -2710,6 +3271,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -2740,6 +3303,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2750,9 +3315,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 = { @@ -2767,6 +3332,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -2774,55 +3344,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 = { @@ -2846,6 +3415,58 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -2884,6 +3505,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -2925,6 +3548,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -2977,6 +3602,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -3020,6 +3647,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -3030,8 +3659,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 = { @@ -3042,6 +3671,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3071,6 +3704,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -3081,15 +3716,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 = { @@ -3106,6 +3741,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 e0f440f9de9a8..b15703ea8ec0f 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 5f6cef7cbf5dc..4b237ba27fc41 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 23f28242e1da9..c0390ba7548fa 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,24 +5,577 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,6 +598,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +637,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,11 +687,13 @@ 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 @@ -178,33 +731,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] + + _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 @@ -222,8 +765,11 @@ 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 @@ -260,33 +806,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,8 +836,11 @@ 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 @@ -334,28 +873,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,8 +898,11 @@ 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 @@ -403,26 +935,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,6 +959,8 @@ 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 @@ -472,33 +998,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,8 +1028,11 @@ 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 @@ -550,33 +1069,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,8 +1099,11 @@ 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 @@ -634,40 +1146,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,14 +1176,18 @@ 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 @@ -723,32 +1226,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,14 +1248,18 @@ 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 @@ -806,31 +1300,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,14 +1322,18 @@ 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 @@ -886,29 +1372,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,14 +1394,18 @@ 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 @@ -969,37 +1449,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,14 +1479,18 @@ 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 @@ -1053,36 +1527,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 +1560,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 4890ee64be3eb..88fc729ee9bb2 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 2c2273ea00fc1..94a48bdda83a0 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 3c3acb2c599c8..a954255a39782 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,24 +5,238 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + skip_token = kwargs.pop('skip_token', None) # type: Optional[str] + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +259,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -82,42 +297,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,11 +347,13 @@ 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 @@ -177,33 +391,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,8 +425,11 @@ 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 @@ -259,33 +466,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -299,8 +496,11 @@ 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 @@ -333,28 +533,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,8 +558,11 @@ 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 @@ -402,28 +595,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 +618,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 326dcbc0444e7..02e12b61a0f14 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 2957ae6212fb1..591a9cb9d49af 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 59390efad1633..efb2ffca5902a 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 952d60742c416..c7833aaca5510 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,26 +5,506 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "geoReplicationStats") # 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') + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +527,7 @@ 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" @@ -58,7 +539,8 @@ 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 @@ -69,30 +551,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,8 +578,10 @@ 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 @@ -121,32 +595,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +626,11 @@ 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 @@ -188,15 +655,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 +679,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,8 +705,10 @@ 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 @@ -268,25 +735,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,6 +758,8 @@ 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 @@ -320,6 +781,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 +793,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,8 +818,11 @@ 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 @@ -405,32 +859,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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,8 +888,11 @@ 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 @@ -455,8 +902,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.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 +913,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,11 +953,13 @@ 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 @@ -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.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 +984,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,11 +1026,13 @@ 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 @@ -605,7 +1051,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 +1064,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,8 +1089,11 @@ 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 @@ -674,7 +1113,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 +1125,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -724,8 +1154,11 @@ 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 @@ -755,32 +1188,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -794,8 +1217,11 @@ 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 @@ -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] + + _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 @@ -864,8 +1280,10 @@ 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 @@ -878,25 +1296,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -909,6 +1319,8 @@ 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 @@ -929,15 +1341,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 +1365,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,8 +1384,10 @@ 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 @@ -1005,25 +1414,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 +1436,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 daffcc3e1e549..ea02e5e45a60d 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 5d0336a6e4cd6..969607371e63d 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2019_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_metadata.json index 25973088a8c5e..a943b8207251a 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 0000000000000..74e48ecd07cf3 --- /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 00cd7a84ebbf0..a50c57a31fc8d 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,39 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -52,17 +35,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 +72,73 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 61c92958ab1e1..25aa6326ab227 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 0000000000000..74e48ecd07cf3 --- /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 60163085e9938..2c4ec8aa10423 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 9e80dd5aa03c7..896fdc20b9977 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 7fb117f121404..2ef9919a351ee 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 39e0cc4125b03..56ec56755b543 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 419100afefae4..a5a7c64057ad2 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 4c99ace8e42b0..07640499f9e2e 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 09a2512ba8db5..c2f503a5c5938 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 29066d82165c1..756f539d94f14 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 f0293809a7f17..2affc86e8a61c 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 299e369b90b8a..160908fe6d830 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 7d02829dc493a..89be934bc5c6f 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 456ab602b2feb..14f2ca7677da8 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 f69485f030477..46d70814540fa 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 614648ded66c2..a984ceeefab52 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 b83745e95012c..3bc5b7c854cd7 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 a4f8a87c0c7b0..b505bfb261fd9 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 ca6d307d82d85..4956d388ba97c 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 e73a0904d4855..4f7b036d5c7d8 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 5241dd42f1186..9ae1292bcb346 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py index ac6432e96daf2..9bc8313ded470 100644 --- 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 @@ -15,31 +15,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 = { @@ -64,6 +64,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -80,19 +108,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 = { @@ -117,6 +145,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -157,6 +201,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,6 +244,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -207,12 +255,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 """ @@ -229,6 +277,15 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -257,15 +314,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", @@ -277,8 +334,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 @@ -341,6 +398,19 @@ def __init__( self, **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 @@ -377,9 +447,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 = { @@ -403,6 +472,11 @@ def __init__( self, **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 @@ -414,8 +488,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 = { @@ -430,6 +504,10 @@ def __init__( self, **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 = kwargs['filters'] @@ -439,15 +517,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 = { @@ -465,6 +543,18 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -477,13 +567,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 = { @@ -502,6 +592,15 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -513,16 +612,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 = { @@ -543,6 +642,18 @@ def __init__( self, **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 = kwargs['enabled'] self.destination = kwargs['destination'] @@ -555,10 +666,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 = { @@ -575,6 +686,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -585,10 +702,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 = { @@ -605,6 +722,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -646,6 +769,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -674,6 +799,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -693,31 +820,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 """ @@ -748,6 +874,36 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -764,12 +920,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 = { @@ -785,6 +941,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -823,6 +987,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -832,17 +998,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 = { @@ -856,6 +1022,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -868,22 +1047,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 = { @@ -906,6 +1085,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -917,9 +1114,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 = { @@ -930,6 +1127,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -939,12 +1141,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 = { @@ -960,6 +1162,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -970,9 +1180,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 = { @@ -987,6 +1197,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -994,13 +1209,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 = { @@ -1017,6 +1232,15 @@ def __init__( self, **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 = 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) @@ -1027,12 +1251,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 = { @@ -1049,6 +1273,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1057,11 +1289,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 = { @@ -1077,6 +1309,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1085,10 +1324,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 = { @@ -1100,6 +1339,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1110,17 +1355,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 = { @@ -1138,6 +1383,19 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1158,21 +1416,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 """ @@ -1199,6 +1457,19 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1210,10 +1481,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 = { @@ -1224,6 +1495,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) @@ -1254,6 +1531,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1264,17 +1543,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 = { @@ -1291,6 +1570,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1300,14 +1588,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 = { @@ -1321,6 +1609,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1345,11 +1643,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 """ @@ -1377,6 +1675,14 @@ def __init__( self, **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 @@ -1391,8 +1697,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 = { @@ -1403,6 +1709,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1410,12 +1720,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 = { @@ -1427,6 +1737,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1453,6 +1771,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1472,12 +1792,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 """ @@ -1501,6 +1821,15 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1524,17 +1853,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. @@ -1543,10 +1872,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. @@ -1596,6 +1925,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1629,17 +1975,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. @@ -1648,10 +1994,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. @@ -1701,6 +2047,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1743,6 +2106,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1786,6 +2151,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -1825,6 +2192,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1845,18 +2214,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 = { @@ -1881,6 +2250,17 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -1896,18 +2276,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 = { @@ -1928,6 +2308,17 @@ def __init__( self, **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 @@ -1941,12 +2332,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 = { @@ -1962,6 +2353,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -1972,12 +2371,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 @@ -2002,6 +2401,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2015,18 +2422,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 = { @@ -2044,6 +2451,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2056,20 +2477,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 = { @@ -2088,6 +2509,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2099,11 +2536,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 = { @@ -2115,6 +2552,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2132,9 +2576,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 = { @@ -2151,6 +2595,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -2166,8 +2615,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 = { @@ -2183,6 +2632,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2209,6 +2662,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2234,6 +2689,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2261,15 +2718,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", @@ -2281,8 +2738,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 @@ -2345,6 +2802,19 @@ def __init__( self, **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 @@ -2390,6 +2860,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2408,8 +2880,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 = { @@ -2429,6 +2901,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -2458,6 +2934,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2484,6 +2962,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2509,6 +2989,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2538,6 +3020,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2564,6 +3048,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2583,9 +3069,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 = { @@ -2607,6 +3093,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -2615,12 +3106,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 = { @@ -2633,6 +3124,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -2642,18 +3141,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 = { @@ -2667,6 +3165,20 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2679,10 +3191,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 = { @@ -2698,6 +3210,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -2708,14 +3226,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 = { @@ -2732,6 +3250,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -2743,15 +3271,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 = { @@ -2771,6 +3299,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -2783,9 +3322,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 = { @@ -2800,6 +3339,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -2807,14 +3351,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 = { @@ -2827,6 +3371,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2836,14 +3390,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 = { @@ -2856,6 +3410,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2865,24 +3429,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 = { @@ -2901,6 +3465,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -2918,18 +3502,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 = { @@ -2947,6 +3531,21 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.virtual_network_rules = kwargs.get('virtual_network_rules', None) @@ -2957,8 +3556,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 = { @@ -2969,6 +3568,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -2990,12 +3593,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 = { @@ -3021,6 +3624,14 @@ def __init__( self, **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 @@ -3032,12 +3643,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 = { @@ -3049,6 +3660,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3059,15 +3678,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 = { @@ -3086,6 +3705,17 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3096,14 +3726,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 = { @@ -3117,6 +3747,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3127,14 +3767,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 = { @@ -3148,6 +3788,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3158,8 +3808,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 = { @@ -3170,6 +3820,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3195,6 +3849,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3212,11 +3868,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". @@ -3244,6 +3900,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3253,8 +3917,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 = { @@ -3265,6 +3929,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3286,8 +3954,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 = { @@ -3311,6 +3979,10 @@ def __init__( self, **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 @@ -3320,8 +3992,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 = { @@ -3332,6 +4004,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3339,15 +4015,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 = { @@ -3360,6 +4036,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -3379,10 +4066,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 = { @@ -3402,6 +4089,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -3413,11 +4106,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. @@ -3442,6 +4135,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -3459,11 +4159,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 = { @@ -3481,6 +4181,13 @@ def __init__( self, **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 @@ -3490,15 +4197,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 = { @@ -3511,6 +4218,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -3522,49 +4240,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 = { @@ -3597,6 +4314,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -3621,8 +4384,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 = { @@ -3633,6 +4397,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -3644,11 +4413,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 @@ -3668,6 +4437,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -3699,6 +4475,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -3711,11 +4489,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 @@ -3730,9 +4508,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 = { @@ -3758,6 +4536,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -3783,10 +4571,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 = { @@ -3808,6 +4596,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -3828,17 +4622,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 @@ -3877,46 +4671,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 = { @@ -3985,6 +4779,42 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4023,8 +4853,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 @@ -4046,6 +4876,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4055,63 +4889,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 = { @@ -4144,6 +4978,65 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -4197,6 +5090,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4234,6 +5129,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4262,6 +5159,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4292,6 +5191,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4338,6 +5239,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4352,9 +5255,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 = { @@ -4369,6 +5272,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -4376,58 +5284,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 = { @@ -4452,6 +5359,61 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -4483,8 +5445,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. @@ -4510,6 +5472,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -4536,6 +5502,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -4543,20 +5511,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 = { @@ -4572,6 +5540,22 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -4616,6 +5600,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -4633,10 +5619,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 = { @@ -4656,6 +5642,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -4665,14 +5657,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 = { @@ -4691,6 +5683,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -4734,6 +5736,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -4786,6 +5790,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -4829,6 +5835,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -4839,8 +5847,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 = { @@ -4851,6 +5859,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -4880,6 +5892,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -4890,15 +5904,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 = { @@ -4915,6 +5929,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 8511407eeb5ff..fb1f9171b4c82 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 7b7c5cc8ba746..c2f69ac92c11e 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 b3c9ed30ebf40..08f115fc1430e 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,24 +5,577 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,6 +598,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +637,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,11 +687,13 @@ 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 @@ -178,33 +731,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] + + _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 @@ -222,8 +765,11 @@ 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 @@ -260,33 +806,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,8 +836,11 @@ 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 @@ -334,28 +873,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,8 +898,11 @@ 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 @@ -403,26 +935,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,6 +959,8 @@ 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 @@ -472,33 +998,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,8 +1028,11 @@ 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 @@ -550,33 +1069,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,8 +1099,11 @@ 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 @@ -634,40 +1146,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,14 +1176,18 @@ 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 @@ -723,32 +1226,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,14 +1248,18 @@ 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 @@ -806,31 +1300,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,14 +1322,18 @@ 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 @@ -886,29 +1372,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,14 +1394,18 @@ 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 @@ -969,37 +1449,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,14 +1479,18 @@ 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 @@ -1053,36 +1527,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 +1560,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 5fbbd9e6aa02e..61364dccc6963 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 d877f294e3eff..ceeaf3b1f6d72 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 3b7bb4057af5c..9bb0976429ab2 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 8e0b085edb969..00365b2f722a8 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 53ae17a491f1f..d494f4716fa06 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,24 +5,284 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', "deleted") # 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "stats") # 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +305,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,7 +331,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 +344,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,11 +394,13 @@ 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 @@ -177,33 +438,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -221,8 +472,11 @@ 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 @@ -259,33 +513,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,8 +543,11 @@ 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 @@ -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,8 +610,11 @@ 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 @@ -407,28 +647,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,6 +671,8 @@ 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 @@ -476,33 +708,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 +736,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 cd321d2461906..629ddbc2923a3 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 28b09ddec8252..0e883cd0d5d8b 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -154,34 +318,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,8 +344,11 @@ 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 @@ -226,39 +383,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +414,11 @@ 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 @@ -299,37 +449,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 a96d3bf80d89b..55ab77085970f 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 24001491246c3..07a02dd3be1a0 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,37 +447,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 d733e262c4b1f..c9ebb10781b04 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 d6bb802dafd7a..f5f08bd9a7039 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,33 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,8 +322,11 @@ 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 @@ -157,33 +362,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,8 +392,11 @@ 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 @@ -231,28 +429,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,8 +454,11 @@ 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 @@ -300,28 +491,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,6 +515,8 @@ 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 @@ -368,40 +551,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 +599,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 a7297a1c3f917..cd22e55668b67 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 7f5287836659b..2b7464a7f2737 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 543c0d4ae4070..4066f6922ebd6 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,26 +5,546 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +567,7 @@ 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" @@ -58,7 +579,8 @@ 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 @@ -69,30 +591,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] + + _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,8 +618,10 @@ 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 @@ -121,32 +635,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +666,11 @@ 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 @@ -188,15 +695,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 +719,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,8 +745,10 @@ 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 @@ -268,25 +775,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,6 +798,8 @@ 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 @@ -332,29 +833,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,8 +858,11 @@ 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 @@ -406,32 +899,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,8 +928,11 @@ 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 @@ -456,8 +942,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.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 +953,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,11 +993,13 @@ 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 @@ -528,8 +1013,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 +1024,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,11 +1066,13 @@ 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 @@ -606,7 +1091,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 +1104,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,8 +1129,11 @@ 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 @@ -675,7 +1153,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 +1165,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,8 +1194,11 @@ 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 @@ -756,32 +1228,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,8 +1257,11 @@ 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 @@ -826,32 +1291,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,8 +1320,10 @@ 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 @@ -879,25 +1336,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1359,8 @@ 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 @@ -930,15 +1381,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 +1405,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,6 +1424,7 @@ 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( @@ -993,32 +1440,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,8 +1473,11 @@ 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 @@ -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,8 +1549,10 @@ 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 @@ -1139,25 +1579,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 +1601,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 155d0c785102d..d6f558d406a67 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,28 +273,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,8 +298,11 @@ 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 @@ -144,28 +334,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,8 +359,11 @@ 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 @@ -212,28 +395,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,8 +420,11 @@ 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 @@ -280,28 +456,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,6 +480,8 @@ 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 @@ -340,36 +508,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 +552,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 6ef68d0babf6e..973e61ac27645 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 6e6699a9122dd..6314d809843ca 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 e095a674c8a61..94e3bebaaea9c 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2020_08_01_preview/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/_metadata.json index ac33786209307..c97e860595d14 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 0000000000000..74e48ecd07cf3 --- /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 f6ebf3b7296a0..4bb1a5d220ca4 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,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -49,121 +31,124 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 9071883d4e24d..aa973cb196911 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 0000000000000..74e48ecd07cf3 --- /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 166e30bd6ae15..91dcd892f59d1 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 3fbfd652f9f8b..7f6fe519cbcaa 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 cb52b18812dc0..acf37fbc6fc89 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 a8b50842fc174..7fa3666e2b39c 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 9ee4432d17475..d3bee9dccaf7f 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 4e3ec3c11bec6..c92d04a48c6d9 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 58e8391bae1d2..801821efe6155 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 e1184cdb8c124..a371d3596c62b 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 7af33facc22d9..c584859b67d38 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 a906c358f4fee..b6b5a201e7a9b 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 f113b28ee1ef5..8eee687fb2f36 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 b965d4e311b28..9dcc1e653717a 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 5a6ade98542b9..8a69188f36503 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 d8541e40852e2..af7dd1724e9de 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 0eb1beeee8e6d..fed47babc9fa2 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 814c41264640a..32dd2f5aff5c4 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 38d4184b62d41..75f2220e087d7 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 cbdcab3a72ba3..dd16f12af75cc 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 f239cb8720cb4..5991a1eabd322 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 c612906d70065..35889f23efbba 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2020_08_01_preview/models/_models.py index 194dcd985483a..5240aece681b1 100644 --- 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 @@ -15,31 +15,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 = { @@ -64,6 +65,35 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -80,19 +110,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 = { @@ -117,6 +147,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -157,6 +203,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,6 +246,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -207,12 +257,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 """ @@ -229,6 +279,15 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -257,15 +316,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", @@ -277,8 +336,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 @@ -341,6 +400,19 @@ def __init__( self, **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 @@ -377,9 +449,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 = { @@ -403,6 +474,11 @@ def __init__( self, **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 @@ -414,8 +490,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 = { @@ -430,6 +506,10 @@ def __init__( self, **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 = kwargs['filters'] @@ -439,15 +519,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 = { @@ -465,6 +545,18 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -477,13 +569,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 = { @@ -502,6 +595,16 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -513,16 +616,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 = { @@ -543,6 +646,18 @@ def __init__( self, **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 = kwargs['enabled'] self.destination = kwargs['destination'] @@ -555,10 +670,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 = { @@ -575,6 +690,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -585,10 +706,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 = { @@ -605,6 +726,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -647,6 +774,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -675,6 +804,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -694,32 +825,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 """ @@ -750,6 +880,37 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -766,12 +927,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 = { @@ -787,6 +948,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -825,6 +994,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -834,17 +1005,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 = { @@ -858,6 +1029,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -870,22 +1054,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 = { @@ -908,6 +1092,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -919,9 +1121,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 = { @@ -932,6 +1134,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -941,12 +1148,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 = { @@ -962,6 +1169,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -972,9 +1187,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 = { @@ -989,6 +1204,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -996,13 +1216,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 = { @@ -1019,6 +1239,15 @@ def __init__( self, **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 = 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) @@ -1055,6 +1284,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1110,6 +1341,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1144,6 +1377,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1154,12 +1389,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 = { @@ -1176,6 +1411,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1184,11 +1427,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 = { @@ -1204,6 +1447,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1212,10 +1462,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 = { @@ -1227,6 +1477,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1237,17 +1493,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 = { @@ -1265,6 +1522,20 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1285,21 +1556,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 """ @@ -1326,6 +1597,19 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1337,10 +1621,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 = { @@ -1351,6 +1635,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) @@ -1381,6 +1671,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1391,17 +1683,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 = { @@ -1418,6 +1710,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1427,14 +1728,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 = { @@ -1448,6 +1749,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1472,11 +1783,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 """ @@ -1504,6 +1815,14 @@ def __init__( self, **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 @@ -1518,8 +1837,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 = { @@ -1530,6 +1849,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1537,12 +1860,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 = { @@ -1554,6 +1877,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1562,10 +1893,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 = { @@ -1577,6 +1908,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -1603,6 +1940,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1622,15 +1961,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 = { @@ -1654,6 +1993,17 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1678,17 +2028,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. @@ -1697,10 +2048,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. @@ -1755,6 +2106,24 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1789,17 +2158,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. @@ -1808,10 +2178,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. @@ -1866,6 +2236,24 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1909,6 +2297,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1952,6 +2342,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -1991,6 +2383,8 @@ def __init__( self, **kwargs ): + """ + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2011,18 +2405,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 = { @@ -2047,6 +2441,17 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -2063,18 +2468,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 = { @@ -2095,6 +2500,17 @@ def __init__( self, **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 @@ -2108,12 +2524,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 = { @@ -2129,6 +2545,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -2139,12 +2563,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 @@ -2169,6 +2593,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2182,18 +2614,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 = { @@ -2211,6 +2643,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2223,20 +2669,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 = { @@ -2255,6 +2702,23 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2266,11 +2730,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 = { @@ -2282,6 +2746,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2299,9 +2770,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 +2789,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -2333,8 +2809,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 = { @@ -2350,6 +2826,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2376,6 +2856,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2401,6 +2883,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2428,15 +2912,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", @@ -2448,8 +2932,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 @@ -2512,6 +2996,19 @@ def __init__( self, **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 @@ -2557,6 +3054,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2575,8 +3074,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 = { @@ -2596,6 +3095,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -2625,6 +3128,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2651,6 +3156,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2676,6 +3183,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2705,6 +3214,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2731,6 +3242,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2750,9 +3263,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 = { @@ -2774,6 +3287,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -2782,12 +3300,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 = { @@ -2800,6 +3318,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -2809,18 +3335,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 = { @@ -2834,6 +3359,21 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2846,10 +3386,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 = { @@ -2865,6 +3405,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -2875,14 +3421,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 = { @@ -2899,6 +3445,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -2910,15 +3466,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 = { @@ -2938,6 +3494,18 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -2950,9 +3518,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 = { @@ -2967,6 +3535,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -2974,14 +3547,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 = { @@ -2994,6 +3567,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3003,14 +3586,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 = { @@ -3023,6 +3606,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3032,24 +3625,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 = { @@ -3068,6 +3661,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -3083,8 +3696,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 = { @@ -3095,6 +3708,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -3104,22 +3721,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 = { @@ -3138,6 +3755,24 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.resource_access_rules = kwargs.get('resource_access_rules', None) @@ -3149,8 +3784,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 = { @@ -3161,6 +3796,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3182,12 +3821,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 = { @@ -3213,6 +3853,15 @@ def __init__( self, **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 @@ -3224,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 = { @@ -3241,6 +3890,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3251,15 +3908,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 = { @@ -3278,6 +3935,18 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3288,14 +3957,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 """ @@ -3310,6 +3979,17 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3320,14 +4000,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 = { @@ -3341,6 +4021,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3351,8 +4041,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 = { @@ -3363,6 +4053,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3388,6 +4082,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3405,11 +4101,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". @@ -3437,6 +4133,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3446,8 +4150,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 = { @@ -3458,6 +4162,11 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3479,8 +4188,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 = { @@ -3504,6 +4213,10 @@ def __init__( self, **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 @@ -3513,8 +4226,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 = { @@ -3525,6 +4238,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3532,15 +4249,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 = { @@ -3553,6 +4270,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -3562,8 +4290,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 = { @@ -3574,6 +4302,10 @@ def __init__( self, **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 = kwargs.get('smb', None) @@ -3591,10 +4323,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 = { @@ -3614,6 +4346,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -3621,10 +4359,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 = { @@ -3636,6 +4374,12 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.resource_id = kwargs.get('resource_id', None) @@ -3648,11 +4392,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. @@ -3677,6 +4421,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -3694,11 +4445,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 = { @@ -3716,6 +4467,13 @@ def __init__( self, **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 @@ -3725,15 +4483,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 = { @@ -3746,6 +4504,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -3757,49 +4526,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 = { @@ -3832,6 +4600,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -3856,8 +4670,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] """ @@ -3869,6 +4683,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -3880,11 +4699,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 @@ -3904,6 +4723,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -3935,6 +4761,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -3947,11 +4775,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 @@ -3966,9 +4794,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 = { @@ -3994,6 +4822,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4007,8 +4845,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 = { @@ -4019,6 +4857,10 @@ def __init__( self, **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 = kwargs.get('multichannel', None) @@ -4038,10 +4880,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 = { @@ -4063,6 +4905,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -4083,19 +4931,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 @@ -4136,48 +4984,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 = { @@ -4247,6 +5095,45 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4286,8 +5173,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 @@ -4309,6 +5196,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4318,68 +5209,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 = { @@ -4413,6 +5304,70 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -4467,6 +5422,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4504,6 +5461,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4532,6 +5491,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4562,6 +5523,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4608,6 +5571,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4622,9 +5587,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 = { @@ -4639,6 +5604,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -4646,59 +5616,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 = { @@ -4723,6 +5692,62 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -4754,8 +5779,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. @@ -4781,6 +5806,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -4807,6 +5836,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -4814,21 +5845,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 = { @@ -4844,6 +5875,23 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -4888,6 +5936,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -4905,10 +5955,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 = { @@ -4928,6 +5978,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -4937,14 +5993,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 = { @@ -4963,6 +6019,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -5006,6 +6072,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5059,6 +6127,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5102,6 +6172,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5112,8 +6184,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 = { @@ -5124,6 +6196,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -5153,6 +6229,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5163,15 +6241,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 = { @@ -5188,6 +6266,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 d7cabcdaa929b..71c7f845641f4 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 80c516d5a23e4..49349134035e9 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 fdfe7b1c84e84..7752570968eef 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,24 +5,577 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,6 +598,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -75,7 +629,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 +638,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,11 +688,13 @@ 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 @@ -178,33 +732,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] + + _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 @@ -222,8 +766,11 @@ 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 @@ -260,33 +807,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,8 +837,11 @@ 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 @@ -334,28 +874,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,8 +899,11 @@ 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 @@ -403,26 +936,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,6 +960,8 @@ 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 @@ -472,33 +999,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,8 +1029,11 @@ 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 @@ -550,33 +1070,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,8 +1100,11 @@ 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 @@ -634,40 +1147,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,14 +1177,18 @@ 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 @@ -723,32 +1227,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,14 +1249,18 @@ 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 @@ -806,31 +1301,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,14 +1323,18 @@ 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 @@ -886,29 +1373,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,14 +1395,18 @@ 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 @@ -969,37 +1450,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,14 +1480,18 @@ 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 @@ -1053,36 +1528,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 +1561,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 f6435704b3d83..4f257c9419f49 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 4e4a4c9648e7f..a26356a40d9b5 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -63,7 +188,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 +197,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,11 +241,13 @@ 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 @@ -154,34 +279,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +308,11 @@ 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 @@ -224,29 +340,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 +364,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 a730ed5b5a75d..8c1817da72f5b 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,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +130,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.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 +141,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,17 +176,19 @@ 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 @@ -136,33 +212,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 +237,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 d4b67060766b4..e622d231c352e 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 c9735efb61a9e..a1322895145ef 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 4b8775427c54b..9673c4f7b32c8 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,24 +5,294 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.ListSharesExpand"]] + + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', "snapshots") # 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "stats") # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +315,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -74,7 +345,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 +354,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,11 +404,13 @@ 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 @@ -168,7 +439,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 +451,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,8 +486,11 @@ 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 @@ -264,33 +527,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,8 +557,11 @@ 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 @@ -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,8 +628,11 @@ 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 @@ -420,30 +668,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,6 +693,8 @@ 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 @@ -491,33 +730,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 +758,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 a574f0faf92bb..84d3530da5465 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 a0584631928d5..1a282b8439016 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -154,34 +318,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,8 +344,11 @@ 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 @@ -226,39 +383,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +414,11 @@ 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 @@ -299,37 +449,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 01b0b2fe61316..0b992ce394aaa 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 34484db5e4b5f..b96ff035a27b7 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,37 +447,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 67d7350740c2b..db63f9e5d619b 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 0294214d9c3da..4cfd397548613 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,33 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,8 +322,11 @@ 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 @@ -157,33 +362,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,8 +392,11 @@ 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 @@ -231,28 +429,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,8 +454,11 @@ 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 @@ -300,28 +491,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,6 +515,8 @@ 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 @@ -360,7 +543,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 +552,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 +600,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 6fa83d5808b55..24d7b8735a571 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 42f8fbad937a4..c40f35e7d3c51 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 7db5cf712d139..b5a7bab537573 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,26 +5,546 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +567,7 @@ 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" @@ -58,7 +579,8 @@ 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 @@ -69,30 +591,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] + + _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,8 +618,10 @@ 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 @@ -121,32 +635,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +666,11 @@ 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 @@ -188,15 +695,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 +720,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,8 +746,10 @@ 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 @@ -268,25 +776,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,6 +799,8 @@ 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 @@ -332,29 +834,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,8 +859,11 @@ 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 @@ -406,32 +900,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,8 +929,11 @@ 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 @@ -456,8 +943,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.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 +954,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,11 +994,13 @@ 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 @@ -528,8 +1014,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 +1025,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,11 +1067,13 @@ 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 @@ -606,7 +1092,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 +1105,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,8 +1130,11 @@ 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 @@ -675,7 +1154,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 +1166,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,8 +1195,11 @@ 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 @@ -756,32 +1229,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,8 +1258,11 @@ 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 @@ -826,32 +1292,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,8 +1321,10 @@ 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 @@ -879,25 +1337,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1360,8 @@ 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 @@ -930,15 +1382,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 +1406,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,6 +1425,7 @@ 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( @@ -993,32 +1441,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,8 +1474,11 @@ 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 @@ -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,8 +1551,10 @@ 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 @@ -1139,25 +1581,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 +1603,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 e5a6604d42dbc..f47074eca4d15 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,28 +273,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,8 +298,11 @@ 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 @@ -144,28 +334,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,8 +359,11 @@ 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 @@ -212,28 +395,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,8 +420,11 @@ 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 @@ -280,28 +456,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,6 +480,8 @@ 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 @@ -332,7 +500,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 +509,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 +553,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 9d2239e03bcb1..a7f0ea501568e 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 7e57fa403c88c..57c7739b737b1 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -58,7 +101,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 +110,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 +152,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 a50d1e1c39a72..1072dc1031610 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 5b966a0f0ab87..3a0eac1336136 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2021_01_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/_metadata.json index 084c5bc5aad0c..43e3fdf5b6fa8 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 0000000000000..74e48ecd07cf3 --- /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 744672f009470..858c34db3fbff 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,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -55,17 +37,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 +74,74 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 bd5adf83c433d..f4d7194170639 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 0000000000000..74e48ecd07cf3 --- /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 4c94224182e88..c0bb8c66dbdc8 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 5ec25418be872..6bb6f43e3dd20 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 0db3d9b56f5d1..238b0d6a1c9cc 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 a574ef16887d4..98e8bfc3ee349 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 caedd8cb02e0e..ebe91e42f0939 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 23a478dcc082c..6265535381207 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 766c575c1a8aa..aea54c6e5e5e2 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 24a24b197fdb6..7bad8db4ed58f 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 1ea23a614d2b5..8fe75b82a28d1 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 21ab00380dff9..fc657773b106e 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 8c61f7a1cef69..6e451b49b564c 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 8672b403dac47..fa430ce785439 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 7ec8b65a6d385..4b8ac11aa0090 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 c65263b218456..0df00dfdec06b 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 50d8d539200a0..67d87744f9efb 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 c1d7a093c0459..2adedceda8b2a 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 25959d4c323d7..b84305e70585d 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 a3a14fac8cac4..71f89b48abff0 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 7eae020c5aa50..ac6dab2890363 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 8533cd128a13c..a2cf547af05bf 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_01_01/models/_models.py index 21a22e1037183..7af30a5acbc54 100644 --- 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 @@ -15,31 +15,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 = { @@ -64,6 +64,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -80,19 +108,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 = { @@ -117,6 +145,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -157,6 +201,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,6 +244,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -207,12 +255,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 """ @@ -229,6 +277,15 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -257,15 +314,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", @@ -277,8 +334,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 @@ -341,6 +398,19 @@ def __init__( self, **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 @@ -377,9 +447,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 = { @@ -403,6 +472,11 @@ def __init__( self, **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 @@ -414,8 +488,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 = { @@ -430,6 +504,10 @@ def __init__( self, **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 = kwargs['filters'] @@ -439,15 +517,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 = { @@ -465,6 +543,18 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -477,13 +567,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 = { @@ -502,6 +592,15 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -513,16 +612,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 = { @@ -543,6 +642,18 @@ def __init__( self, **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 = kwargs['enabled'] self.destination = kwargs['destination'] @@ -555,10 +666,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 = { @@ -575,6 +686,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -585,10 +702,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 = { @@ -605,6 +722,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -646,6 +769,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -674,6 +799,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -693,31 +820,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 """ @@ -748,6 +874,36 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -764,12 +920,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 = { @@ -785,6 +941,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -823,6 +987,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -832,17 +998,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 = { @@ -856,6 +1022,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -868,22 +1047,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 = { @@ -906,6 +1085,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -917,9 +1114,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 = { @@ -930,6 +1127,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -939,12 +1141,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 = { @@ -960,6 +1162,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -970,9 +1180,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 = { @@ -987,6 +1197,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -994,13 +1209,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 = { @@ -1017,6 +1232,15 @@ def __init__( self, **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 = 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) @@ -1053,6 +1277,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1108,6 +1334,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1142,6 +1370,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1152,12 +1382,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 = { @@ -1174,6 +1404,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1182,11 +1420,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 = { @@ -1202,6 +1440,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1210,10 +1455,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 = { @@ -1225,6 +1470,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1235,19 +1486,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 = { @@ -1266,6 +1517,21 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1277,9 +1543,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 = { @@ -1290,6 +1556,11 @@ def __init__( self, **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 = kwargs.get('encryption_user_assigned_identity', None) @@ -1307,25 +1578,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 = { @@ -1352,6 +1623,22 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1366,10 +1653,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 @@ -1392,6 +1679,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) self.current_versioned_key_identifier = None @@ -1424,6 +1717,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1434,17 +1729,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 = { @@ -1461,6 +1756,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1470,14 +1774,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 = { @@ -1491,6 +1795,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1515,11 +1829,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 """ @@ -1547,6 +1861,14 @@ def __init__( self, **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 @@ -1561,8 +1883,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 = { @@ -1573,6 +1895,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1580,12 +1906,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 = { @@ -1597,6 +1923,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1605,10 +1939,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 = { @@ -1620,6 +1954,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -1646,6 +1986,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1665,15 +2007,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 = { @@ -1697,6 +2039,17 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1721,17 +2074,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. @@ -1740,10 +2093,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. @@ -1798,6 +2151,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1832,17 +2202,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. @@ -1851,10 +2221,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. @@ -1909,6 +2279,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1952,6 +2339,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1995,6 +2384,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2012,13 +2403,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] """ @@ -2039,6 +2430,16 @@ def __init__( self, **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 @@ -2061,18 +2462,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 = { @@ -2097,6 +2498,17 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -2112,18 +2524,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 = { @@ -2144,6 +2556,17 @@ def __init__( self, **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 @@ -2157,12 +2580,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 = { @@ -2178,6 +2601,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -2188,12 +2619,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 @@ -2218,6 +2649,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2231,18 +2670,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 = { @@ -2260,6 +2699,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2272,20 +2725,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 = { @@ -2304,6 +2757,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2315,11 +2784,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 = { @@ -2331,6 +2800,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2348,9 +2824,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 = { @@ -2367,6 +2843,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -2382,8 +2863,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 = { @@ -2399,6 +2880,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2425,6 +2910,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2450,6 +2937,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2477,15 +2966,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", @@ -2497,8 +2986,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 @@ -2561,6 +3050,19 @@ def __init__( self, **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 @@ -2606,6 +3108,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2624,8 +3128,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 = { @@ -2645,6 +3149,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -2674,6 +3182,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2700,6 +3210,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2725,6 +3237,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2754,6 +3268,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2780,6 +3296,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2799,9 +3317,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 = { @@ -2823,6 +3341,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -2831,12 +3354,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 = { @@ -2849,6 +3372,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -2858,18 +3389,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 = { @@ -2883,6 +3413,20 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2895,10 +3439,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 = { @@ -2914,6 +3458,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -2924,14 +3474,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 = { @@ -2948,6 +3498,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -2959,15 +3519,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 = { @@ -2987,6 +3547,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -2999,9 +3570,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 = { @@ -3016,6 +3587,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -3023,14 +3599,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 = { @@ -3043,6 +3619,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3052,14 +3638,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 = { @@ -3072,6 +3658,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3081,24 +3677,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 = { @@ -3117,6 +3713,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -3132,8 +3748,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 = { @@ -3144,6 +3760,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -3153,20 +3773,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 = { @@ -3185,6 +3805,24 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.resource_access_rules = kwargs.get('resource_access_rules', None) @@ -3196,8 +3834,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 = { @@ -3208,6 +3846,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3229,12 +3871,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 = { @@ -3260,6 +3902,14 @@ def __init__( self, **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 @@ -3271,12 +3921,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 = { @@ -3288,6 +3938,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3298,15 +3956,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 = { @@ -3325,6 +3983,17 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3335,14 +4004,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 = { @@ -3356,6 +4025,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3366,14 +4045,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 = { @@ -3387,6 +4066,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3397,8 +4086,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 = { @@ -3409,6 +4098,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3434,6 +4127,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3451,11 +4146,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". @@ -3483,6 +4178,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3492,8 +4195,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 = { @@ -3504,6 +4207,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3525,8 +4232,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 = { @@ -3550,6 +4257,10 @@ def __init__( self, **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 @@ -3559,8 +4270,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 = { @@ -3571,6 +4282,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3578,15 +4293,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 = { @@ -3599,6 +4314,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -3608,8 +4334,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 = { @@ -3620,6 +4346,10 @@ def __init__( self, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_01_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = kwargs.get('smb', None) @@ -3637,10 +4367,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 = { @@ -3660,6 +4390,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -3667,10 +4403,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 = { @@ -3682,6 +4418,12 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.resource_id = kwargs.get('resource_id', None) @@ -3694,11 +4436,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. @@ -3723,6 +4465,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -3740,11 +4489,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 = { @@ -3762,6 +4511,13 @@ def __init__( self, **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 @@ -3771,15 +4527,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 = { @@ -3792,6 +4548,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -3803,49 +4570,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 = { @@ -3878,6 +4644,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -3902,8 +4714,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 = { @@ -3914,6 +4727,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -3925,11 +4743,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 @@ -3949,6 +4767,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -3980,6 +4805,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -3992,11 +4819,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 @@ -4011,9 +4838,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 = { @@ -4039,6 +4866,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4052,20 +4889,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 = { @@ -4080,6 +4917,22 @@ def __init__( self, **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 = kwargs.get('multichannel', None) self.versions = kwargs.get('versions', None) @@ -4103,10 +4956,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 = { @@ -4128,6 +4981,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -4148,19 +5007,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 @@ -4199,48 +5058,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 = { @@ -4311,6 +5170,46 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4351,8 +5250,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 @@ -4374,6 +5273,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4383,69 +5286,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 = { @@ -4480,6 +5383,71 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -4535,6 +5503,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4572,6 +5542,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4600,6 +5572,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4630,6 +5604,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4676,6 +5652,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4690,9 +5668,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 = { @@ -4707,6 +5685,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -4714,58 +5697,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 = { @@ -4790,6 +5772,61 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -4821,8 +5858,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. @@ -4848,6 +5885,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -4874,6 +5915,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -4881,20 +5924,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 = { @@ -4910,6 +5953,22 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -4954,6 +6013,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -4971,10 +6032,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 = { @@ -4994,6 +6055,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -5003,14 +6070,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 = { @@ -5029,6 +6096,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -5072,6 +6149,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5124,6 +6203,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5167,6 +6248,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5177,8 +6260,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 = { @@ -5189,6 +6272,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -5218,6 +6305,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5248,6 +6337,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5258,15 +6349,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 = { @@ -5283,6 +6374,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 ce32c85370848..f543a33f38375 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 bccc88e90fb00..38f7e753f2577 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 71f641b6641c2..47f2b575a6d60 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,24 +5,577 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,6 +598,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +637,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,11 +687,13 @@ 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 @@ -178,33 +731,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] + + _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 @@ -222,8 +765,11 @@ 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 @@ -260,33 +806,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,8 +836,11 @@ 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 @@ -334,28 +873,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,8 +898,11 @@ 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 @@ -403,26 +935,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,6 +959,8 @@ 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 @@ -472,33 +998,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,8 +1028,11 @@ 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 @@ -550,33 +1069,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,8 +1099,11 @@ 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 @@ -634,40 +1146,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,14 +1176,18 @@ 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 @@ -723,32 +1226,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,14 +1248,18 @@ 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 @@ -806,31 +1300,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,14 +1322,18 @@ 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 @@ -886,29 +1372,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,14 +1394,18 @@ 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 @@ -969,37 +1449,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,14 +1479,18 @@ 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 @@ -1053,36 +1527,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 +1560,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 7a270d56fc21a..aa724ec0079a0 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 0d43959e0413d..a9a712d7e7bd8 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 2f9d2488b272d..62a0455745754 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,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +130,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.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 +141,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,17 +176,19 @@ 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 @@ -136,33 +212,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 +237,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 cde30462cbebf..76e0c234b3acb 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 373f185c9dd87..bec260657805c 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 cab0274a35188..bf018fb4c5421 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,24 +5,294 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.ListSharesExpand"]] + + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.PutSharesExpand"]] + + 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "stats") # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +315,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -82,42 +353,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,11 +403,13 @@ 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 @@ -180,35 +450,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,8 +485,11 @@ 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 @@ -264,33 +526,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,8 +556,11 @@ 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 @@ -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,8 +627,11 @@ 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 @@ -420,30 +667,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,6 +692,8 @@ 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 @@ -491,33 +729,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 +757,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 befa7fd778402..18fc3c6022b22 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 964e5a958d405..c3b928469a74f 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -154,34 +318,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,8 +344,11 @@ 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 @@ -226,39 +383,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +414,11 @@ 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 @@ -299,37 +449,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 c92895c524b06..6b4e8b4afa9bc 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 bdc85a1e1b9b8..1328f63075d62 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,37 +447,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 ad8ec33c6d05f..0e394b12eb93d 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 e605d8fff9241..5de43bc9c9766 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,33 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,8 +322,11 @@ 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 @@ -157,33 +362,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,8 +392,11 @@ 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 @@ -231,28 +429,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,8 +454,11 @@ 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 @@ -300,28 +491,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,6 +515,8 @@ 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 @@ -368,40 +551,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 +599,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 7c996f220d57d..775a00e267f6e 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 05c57efc2e7e6..d1094f1ebfbfc 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 97ccc9fd067ec..9270c1ed62bf8 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,26 +5,546 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +567,7 @@ 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" @@ -58,7 +579,8 @@ 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 @@ -69,30 +591,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] + + _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,8 +618,10 @@ 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 @@ -121,32 +635,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +666,11 @@ 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 @@ -188,15 +695,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 +719,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,8 +745,10 @@ 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 @@ -268,25 +775,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,6 +798,8 @@ 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 @@ -332,29 +833,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,8 +858,11 @@ 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 @@ -406,32 +899,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,8 +928,11 @@ 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 @@ -456,8 +942,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.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 +953,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,11 +993,13 @@ 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 @@ -528,8 +1013,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 +1024,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,11 +1066,13 @@ 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 @@ -606,7 +1091,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 +1104,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,8 +1129,11 @@ 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 @@ -675,7 +1153,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 +1165,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,8 +1194,11 @@ 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 @@ -756,32 +1228,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,8 +1257,11 @@ 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 @@ -826,32 +1291,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,8 +1320,10 @@ 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 @@ -879,25 +1336,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1359,8 @@ 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 @@ -930,15 +1381,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 +1405,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,6 +1424,7 @@ 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( @@ -993,32 +1440,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,8 +1473,11 @@ 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 @@ -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,8 +1549,10 @@ 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 @@ -1139,25 +1579,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 +1601,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 57ada786cad44..a289f028b38d7 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,28 +273,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,8 +298,11 @@ 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 @@ -144,28 +334,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,8 +359,11 @@ 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 @@ -212,28 +395,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,8 +420,11 @@ 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 @@ -280,28 +456,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,6 +480,8 @@ 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 @@ -340,36 +508,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 +552,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 cc7fae88b319d..aad640aba542e 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 580f3599ccfb9..26d5f11c9743e 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 8b84770f1df96..8b8c8c25c1439 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2021_02_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/_metadata.json index f4dc9ffd9d4bb..aa6f7acf22e6a 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 0000000000000..74e48ecd07cf3 --- /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 62bbd9818f249..2f7ec66fd606c 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,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -55,17 +37,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 +74,74 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 842f8ada255d2..16da1f3188dff 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 0000000000000..74e48ecd07cf3 --- /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 84b8a89e6b310..fa820f3c5bd89 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 7773c9cb187e1..21bc3f7f4d791 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 26347aabee8d1..570b62d2e1498 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 eac22724fa55a..492456411deed 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 493edc60ee1ca..28d0cbf8f654d 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 8e4cfa2891759..051c1d6e475a6 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 b1a8c6fdfdcaf..50d1e18742a99 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 28fdb00800686..4547bd16f533d 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 6ff754af14a18..e4f78432c2a8a 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 1cc042f1c30b6..4697cb820a463 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 4defdab67ac34..c4bb5dfc8069c 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 d35508c36cca9..c49d1f31e7913 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 b510330027ad4..69ffbf500d318 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 cfb603403b6e5..d846b7c3ea8ad 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 916c0cb85c1d6..41d3980c43ac8 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 53e098893fa7f..8f672833aa43d 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 e60dfe68b3998..2e9cabb1509d8 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 6d851ce472df9..f5489bfecfd22 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 fc661d2fd5d0f..82a1b18b0dbd8 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 2f546eb904319..6d24b462b3c3a 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_02_01/models/_models.py index 4dc29f6b362c7..79c16579d6f2a 100644 --- 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 @@ -15,31 +15,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 = { @@ -64,6 +64,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -80,19 +108,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 = { @@ -117,6 +145,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -157,6 +201,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,6 +244,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -207,12 +255,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 """ @@ -229,6 +277,15 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -257,15 +314,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", @@ -277,8 +334,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 @@ -341,6 +398,19 @@ def __init__( self, **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 @@ -377,9 +447,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 = { @@ -403,6 +472,11 @@ def __init__( self, **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 @@ -414,8 +488,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 = { @@ -430,6 +504,10 @@ def __init__( self, **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 = kwargs['filters'] @@ -439,15 +517,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 = { @@ -465,6 +543,18 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -477,13 +567,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 = { @@ -502,6 +592,15 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -513,16 +612,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 = { @@ -543,6 +642,18 @@ def __init__( self, **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 = kwargs['enabled'] self.destination = kwargs['destination'] @@ -555,10 +666,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 = { @@ -575,6 +686,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -585,10 +702,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 = { @@ -605,6 +722,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -646,6 +769,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -674,6 +799,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -693,31 +820,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 """ @@ -748,6 +874,36 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -764,12 +920,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 = { @@ -785,6 +941,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -823,6 +987,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -832,17 +998,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 = { @@ -856,6 +1022,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -868,22 +1047,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 = { @@ -906,6 +1085,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -917,9 +1114,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 = { @@ -930,6 +1127,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -939,12 +1141,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 = { @@ -960,6 +1162,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -970,9 +1180,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 = { @@ -987,6 +1197,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -994,13 +1209,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 = { @@ -1017,6 +1232,15 @@ def __init__( self, **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 = 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) @@ -1053,6 +1277,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1108,6 +1334,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1142,6 +1370,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1152,12 +1382,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 = { @@ -1174,6 +1404,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1182,11 +1420,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 = { @@ -1202,6 +1440,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1210,10 +1455,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 = { @@ -1225,6 +1470,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1235,19 +1486,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 = { @@ -1266,6 +1517,21 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1277,9 +1543,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 = { @@ -1290,6 +1556,11 @@ def __init__( self, **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 = kwargs.get('encryption_user_assigned_identity', None) @@ -1307,25 +1578,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 = { @@ -1352,6 +1623,22 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1366,10 +1653,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 @@ -1392,6 +1679,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) self.current_versioned_key_identifier = None @@ -1424,6 +1717,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1434,17 +1729,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 = { @@ -1461,6 +1756,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1470,14 +1774,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 = { @@ -1491,6 +1795,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1515,11 +1829,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 """ @@ -1547,6 +1861,14 @@ def __init__( self, **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 @@ -1561,8 +1883,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 = { @@ -1573,6 +1895,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1580,12 +1906,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 = { @@ -1597,6 +1923,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1605,10 +1939,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 = { @@ -1620,6 +1954,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -1646,6 +1986,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1665,15 +2007,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 = { @@ -1697,6 +2039,17 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1721,17 +2074,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. @@ -1740,10 +2093,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. @@ -1798,6 +2151,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1832,17 +2202,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. @@ -1851,10 +2221,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. @@ -1909,6 +2279,23 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1952,6 +2339,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1995,6 +2384,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2012,13 +2403,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] """ @@ -2039,6 +2430,16 @@ def __init__( self, **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 @@ -2061,18 +2462,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 = { @@ -2097,6 +2498,17 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -2112,18 +2524,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 = { @@ -2144,6 +2556,17 @@ def __init__( self, **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 @@ -2157,12 +2580,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 = { @@ -2178,6 +2601,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -2186,10 +2617,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 = { @@ -2201,6 +2632,12 @@ def __init__( self, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -2211,8 +2648,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 = { @@ -2227,6 +2664,10 @@ def __init__( self, **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 = kwargs['key_expiration_period_in_days'] @@ -2236,12 +2677,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 @@ -2266,6 +2707,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2279,18 +2728,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 = { @@ -2308,6 +2757,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2320,20 +2783,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 = { @@ -2352,6 +2815,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2363,11 +2842,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 = { @@ -2379,6 +2858,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2396,9 +2882,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 = { @@ -2415,6 +2901,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -2430,8 +2921,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 = { @@ -2447,6 +2938,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2473,6 +2968,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2498,6 +2995,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2525,15 +3024,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", @@ -2545,8 +3044,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 @@ -2609,6 +3108,19 @@ def __init__( self, **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 @@ -2654,6 +3166,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2672,8 +3186,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 = { @@ -2693,6 +3207,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -2722,6 +3240,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2748,6 +3268,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -2773,6 +3295,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -2802,6 +3326,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2828,6 +3354,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -2847,9 +3375,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 = { @@ -2871,6 +3399,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -2879,12 +3412,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 = { @@ -2897,6 +3430,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -2906,18 +3447,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 = { @@ -2931,6 +3471,20 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -2943,10 +3497,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 = { @@ -2962,6 +3516,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -2972,14 +3532,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 = { @@ -2996,6 +3556,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -3007,15 +3577,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 = { @@ -3035,6 +3605,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -3047,9 +3628,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 = { @@ -3064,6 +3645,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -3071,14 +3657,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 = { @@ -3091,6 +3677,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3100,14 +3696,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 = { @@ -3120,6 +3716,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3129,24 +3735,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 = { @@ -3165,6 +3771,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -3180,8 +3806,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 = { @@ -3192,6 +3818,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -3201,20 +3831,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 = { @@ -3233,6 +3863,24 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.resource_access_rules = kwargs.get('resource_access_rules', None) @@ -3244,8 +3892,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 = { @@ -3256,6 +3904,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3277,12 +3929,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 = { @@ -3308,6 +3960,14 @@ def __init__( self, **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 @@ -3319,12 +3979,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 = { @@ -3336,6 +3996,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3346,15 +4014,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 = { @@ -3373,6 +4041,17 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3383,14 +4062,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 = { @@ -3404,6 +4083,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3414,14 +4103,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 = { @@ -3435,6 +4124,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3445,8 +4144,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 = { @@ -3457,6 +4156,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3482,6 +4185,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3499,11 +4204,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". @@ -3531,6 +4236,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3540,8 +4253,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 = { @@ -3552,6 +4265,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3573,8 +4290,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 = { @@ -3598,6 +4315,10 @@ def __init__( self, **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 @@ -3607,8 +4328,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 = { @@ -3619,6 +4340,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3626,15 +4351,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 = { @@ -3647,6 +4372,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -3656,8 +4392,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 = { @@ -3668,6 +4404,10 @@ def __init__( self, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_02_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = kwargs.get('smb', None) @@ -3685,10 +4425,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 = { @@ -3708,6 +4448,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -3715,10 +4461,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 = { @@ -3730,6 +4476,12 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.resource_id = kwargs.get('resource_id', None) @@ -3742,11 +4494,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. @@ -3771,6 +4523,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -3788,11 +4547,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 = { @@ -3810,6 +4569,13 @@ def __init__( self, **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 @@ -3819,15 +4585,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 = { @@ -3840,6 +4606,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -3851,11 +4628,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 = { @@ -3872,6 +4649,13 @@ def __init__( self, **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 = kwargs['sas_expiration_period'] self.expiration_action = kwargs.get('expiration_action', "Log") @@ -3882,49 +4666,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 = { @@ -3957,6 +4740,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -3981,8 +4810,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 = { @@ -3993,6 +4823,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -4004,11 +4839,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 @@ -4028,6 +4863,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4059,6 +4901,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4071,11 +4915,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 @@ -4090,9 +4934,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 = { @@ -4118,6 +4962,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4131,20 +4985,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 = { @@ -4159,6 +5013,22 @@ def __init__( self, **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 = kwargs.get('multichannel', None) self.versions = kwargs.get('versions', None) @@ -4182,10 +5052,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 = { @@ -4207,6 +5077,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -4227,19 +5103,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 @@ -4284,48 +5160,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 = { @@ -4402,6 +5278,46 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4445,8 +5361,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 @@ -4468,6 +5384,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4477,73 +5397,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 = { @@ -4580,6 +5500,75 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -4637,6 +5626,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4678,6 +5669,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -4707,6 +5700,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -4737,6 +5732,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -4783,6 +5780,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -4797,9 +5796,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 = { @@ -4814,6 +5813,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -4821,62 +5825,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 = { @@ -4903,6 +5906,65 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -4936,8 +5998,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. @@ -4963,6 +6025,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -4989,6 +6055,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -4996,20 +6064,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 = { @@ -5025,6 +6093,22 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -5069,6 +6153,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5086,10 +6172,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 = { @@ -5109,6 +6195,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -5118,14 +6210,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 = { @@ -5144,6 +6236,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -5187,6 +6289,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5239,6 +6343,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5282,6 +6388,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5292,8 +6400,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 = { @@ -5304,6 +6412,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -5333,6 +6445,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5363,6 +6477,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5373,15 +6489,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 = { @@ -5398,6 +6514,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 080542258ce27..898b0261417ad 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 f4fe9fdaa2606..2c4c8c6bcf538 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 fcaeb6eddd6c9..3c2641caa05c6 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,24 +5,577 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -45,6 +598,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +637,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,11 +687,13 @@ 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 @@ -178,33 +731,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] + + _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 @@ -222,8 +765,11 @@ 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 @@ -260,33 +806,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,8 +836,11 @@ 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 @@ -334,28 +873,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,8 +898,11 @@ 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 @@ -403,26 +935,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,6 +959,8 @@ 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 @@ -472,33 +998,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,8 +1028,11 @@ 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 @@ -550,33 +1069,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,8 +1099,11 @@ 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 @@ -634,40 +1146,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,14 +1176,18 @@ 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 @@ -723,32 +1226,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,14 +1248,18 @@ 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 @@ -806,31 +1300,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,14 +1322,18 @@ 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 @@ -886,29 +1372,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,14 +1394,18 @@ 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 @@ -969,37 +1449,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,14 +1479,18 @@ 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 @@ -1053,36 +1527,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 +1560,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 15dbb8bc52714..821c835d9a145 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 5e4ffe367da91..6c2a89c5afbe2 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 93fb0dcdbc5f8..3fd8bf611020c 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,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +130,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.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 +141,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,17 +176,19 @@ 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 @@ -136,33 +212,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 +237,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 33d54b529b568..19f8480041a52 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 47c4c852058e2..5978f99c1a694 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 f2ac752dbf74d..0aa869fbe7a65 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,24 +5,294 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.ListSharesExpand"]] + + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.PutSharesExpand"]] + + 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "stats") # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +315,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -82,42 +353,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,11 +403,13 @@ 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 @@ -180,35 +450,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,8 +485,11 @@ 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 @@ -264,33 +526,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,8 +556,11 @@ 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 @@ -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,8 +627,11 @@ 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 @@ -420,30 +667,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,6 +692,8 @@ 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 @@ -491,33 +729,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 +757,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 4679cdf31df17..a9808c239491a 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 c100b853f9399..c70099e3f6696 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -154,34 +318,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,8 +344,11 @@ 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 @@ -226,39 +383,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +414,11 @@ 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 @@ -299,37 +449,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 8e6ad26eeb245..0b7259fc851d2 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 43b1ea1c157da..3aacb378d0cca 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,37 +447,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 0e505bf5c0bf6..62ee13f129543 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 d5e7fdcac6760..b11392daf676a 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,33 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -120,8 +322,11 @@ 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 @@ -157,33 +362,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,8 +392,11 @@ 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 @@ -231,28 +429,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,8 +454,11 @@ 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 @@ -300,28 +491,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,6 +515,8 @@ 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 @@ -368,40 +551,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 +599,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 b91df8883103b..145a197263e58 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 5baf31bb9ec22..949b258522d1b 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 47c07ebfcb523..a6aed172f9eae 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,26 +5,546 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +567,7 @@ 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" @@ -58,7 +579,8 @@ 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 @@ -69,30 +591,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] + + _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,8 +618,10 @@ 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 @@ -121,32 +635,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +666,11 @@ 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 @@ -188,15 +695,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 +719,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,8 +745,10 @@ 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 @@ -268,25 +775,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,6 +798,8 @@ 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 @@ -332,29 +833,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,8 +858,11 @@ 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 @@ -406,32 +899,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,8 +928,11 @@ 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 @@ -456,8 +942,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.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 +953,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,11 +993,13 @@ 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 @@ -528,8 +1013,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 +1024,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,11 +1066,13 @@ 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 @@ -606,7 +1091,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 +1104,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,8 +1129,11 @@ 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 @@ -675,7 +1153,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 +1165,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,8 +1194,11 @@ 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 @@ -756,32 +1228,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,8 +1257,11 @@ 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 @@ -826,32 +1291,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,8 +1320,10 @@ 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 @@ -879,25 +1336,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1359,8 @@ 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 @@ -930,15 +1381,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 +1405,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,6 +1424,7 @@ 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( @@ -993,32 +1440,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,8 +1473,11 @@ 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 @@ -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,8 +1549,10 @@ 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 @@ -1139,25 +1579,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 +1601,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 370bf18b70d15..b8850ead5c20a 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,28 +273,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,8 +298,11 @@ 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 @@ -144,28 +334,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,8 +359,11 @@ 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 @@ -212,28 +395,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,8 +420,11 @@ 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 @@ -280,28 +456,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,6 +480,8 @@ 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 @@ -340,36 +508,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 +552,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 7421eed424c37..db3db96bd4737 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,27 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,8 +219,11 @@ 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 @@ -137,34 +255,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -178,8 +284,11 @@ 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 @@ -207,29 +316,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 +340,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 0a8d406c4a186..a5086fec9b077 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 353e929caf0c2..a3b6fb6a0f2fc 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2021_04_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/_metadata.json index cf0bcf35807c7..b21b95219e924 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 0000000000000..74e48ecd07cf3 --- /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 8f9ee1bfcb0eb..086c77806138b 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,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -55,17 +37,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 +74,74 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 f23229b6d6eca..9ba3f2dc71c9b 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 0000000000000..74e48ecd07cf3 --- /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 d99778b3abef5..19c81e0f0a0bd 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 a33a46f660c8e..a093d01675bd1 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 5db228f296d89..1ce152b88419c 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 afdd15842a399..0ab3345263d0a 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 6ef845000d4b3..b9cfeddc11479 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 c3e1d35abff23..e9981b3895260 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 42a5083fc2e5d..1d8989a361cc6 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 e61cb48fafb6e..f84326c85c44c 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 d351d125a0f63..36179b99e6c34 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 0d318fb806b77..1a40b9bcd7a60 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 ec690abe837df..fb7fdb3e07191 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 f9802d8596887..52eb4c9342f1e 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 a340af4dd0c8d..3100d697ce885 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 d6b2efbd39d68..f5d13f2a3bbe5 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 015027550a174..b9d96b4025ef2 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 9250537c5fdb9..0724b60000daf 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 f4380271a9543..9934023f188a8 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 ab2f3fc20397a..8424f123fb22e 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 dae40c4d10f89..46ce22c14dc08 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 fab2699d72553..161eeda8c0fb0 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_04_01/models/_models.py index 91eabb7bbf9a1..ef40185f06980 100644 --- 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 @@ -13,12 +13,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 = { @@ -31,6 +31,14 @@ def __init__( self, **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 = kwargs.get('start_time', None) self.expiry_time = kwargs.get('expiry_time', None) @@ -42,31 +50,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 = { @@ -91,6 +99,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -107,19 +143,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 = { @@ -144,6 +180,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -184,6 +236,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -225,6 +279,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -234,18 +290,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 """ @@ -263,6 +319,21 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -292,15 +363,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", @@ -312,8 +383,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 @@ -328,10 +399,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 """ @@ -382,6 +453,24 @@ def __init__( self, **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 @@ -419,9 +508,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 = { @@ -445,6 +533,11 @@ def __init__( self, **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 @@ -456,19 +549,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, @@ -478,7 +571,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 = { @@ -500,6 +593,31 @@ def __init__( self, **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 = kwargs.get('filters', None) self.format = kwargs['format'] @@ -511,20 +629,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 = { @@ -538,6 +656,22 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs.get('blob_types', None) @@ -550,16 +684,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 = { @@ -580,6 +714,18 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -592,13 +738,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 = { @@ -617,6 +763,15 @@ def __init__( self, **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 = kwargs['enabled'] self.type = kwargs['type'] @@ -628,10 +783,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 = { @@ -648,6 +803,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -658,10 +819,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 = { @@ -678,6 +839,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -719,6 +886,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -747,6 +916,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -766,31 +937,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 """ @@ -821,6 +991,36 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -837,12 +1037,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 = { @@ -858,6 +1058,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -896,6 +1104,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -905,8 +1115,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 = { @@ -917,6 +1127,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -924,17 +1138,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 = { @@ -948,6 +1162,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -958,17 +1185,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 = { @@ -982,6 +1209,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -994,22 +1234,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 = { @@ -1032,6 +1272,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -1043,9 +1301,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 = { @@ -1056,6 +1314,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -1065,12 +1328,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 = { @@ -1086,6 +1349,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -1096,9 +1367,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 = { @@ -1113,6 +1384,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -1120,13 +1396,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 = { @@ -1143,6 +1419,15 @@ def __init__( self, **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 = 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) @@ -1179,6 +1464,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1234,6 +1521,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1268,6 +1557,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1278,12 +1569,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 = { @@ -1300,6 +1591,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1308,11 +1607,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 = { @@ -1328,6 +1627,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1336,10 +1642,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 = { @@ -1351,6 +1657,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1361,19 +1673,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 = { @@ -1392,6 +1704,21 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1403,9 +1730,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 = { @@ -1416,6 +1743,11 @@ def __init__( self, **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 = kwargs.get('encryption_user_assigned_identity', None) @@ -1433,25 +1765,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 = { @@ -1478,6 +1810,22 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1492,10 +1840,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 @@ -1518,6 +1866,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) self.current_versioned_key_identifier = None @@ -1550,6 +1904,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1560,17 +1916,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 = { @@ -1587,6 +1943,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1596,14 +1961,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 = { @@ -1617,6 +1982,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1641,11 +2016,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 """ @@ -1673,6 +2048,14 @@ def __init__( self, **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 @@ -1687,8 +2070,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 = { @@ -1699,6 +2082,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1706,12 +2093,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 = { @@ -1723,6 +2110,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1731,10 +2126,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 = { @@ -1746,6 +2141,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -1772,6 +2173,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1791,15 +2194,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 = { @@ -1823,6 +2226,17 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1847,17 +2261,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. @@ -1866,10 +2280,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. @@ -1886,8 +2300,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 @@ -1942,6 +2356,25 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -1980,17 +2413,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. @@ -1999,10 +2432,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. @@ -2019,8 +2452,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 @@ -2075,6 +2508,25 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -2122,6 +2574,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2165,6 +2619,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2182,13 +2638,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] """ @@ -2209,6 +2665,16 @@ def __init__( self, **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 @@ -2231,18 +2697,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 = { @@ -2267,6 +2733,17 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -2282,18 +2759,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 = { @@ -2314,6 +2791,17 @@ def __init__( self, **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 @@ -2327,9 +2815,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 @@ -2352,6 +2840,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.time_stamp = None @@ -2363,12 +2856,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 = { @@ -2384,6 +2877,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -2392,10 +2893,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 = { @@ -2407,6 +2908,12 @@ def __init__( self, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -2417,8 +2924,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 = { @@ -2433,6 +2940,10 @@ def __init__( self, **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 = kwargs['key_expiration_period_in_days'] @@ -2442,12 +2953,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 @@ -2472,6 +2983,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2485,18 +3004,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 = { @@ -2514,6 +3033,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2526,20 +3059,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 = { @@ -2558,6 +3091,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2569,11 +3118,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 = { @@ -2585,6 +3134,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2595,20 +3151,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 = { @@ -2627,6 +3183,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2638,11 +3210,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 = { @@ -2654,6 +3226,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2671,9 +3250,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 = { @@ -2690,6 +3269,11 @@ def __init__( self, **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 = kwargs['tags'] @@ -2705,8 +3289,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 = { @@ -2722,6 +3306,10 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2748,6 +3336,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2773,6 +3363,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2800,15 +3392,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", @@ -2820,8 +3412,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 @@ -2836,10 +3428,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 """ @@ -2890,6 +3482,24 @@ def __init__( self, **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 @@ -2936,6 +3546,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2954,8 +3566,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 = { @@ -2975,6 +3587,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -3004,6 +3620,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3030,6 +3648,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -3055,6 +3675,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -3084,6 +3706,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3110,6 +3734,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -3129,9 +3755,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 = { @@ -3153,6 +3779,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -3161,12 +3792,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 = { @@ -3179,6 +3810,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -3188,18 +3827,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 = { @@ -3213,6 +3851,20 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3225,10 +3877,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 = { @@ -3244,6 +3896,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -3254,14 +3912,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 = { @@ -3278,6 +3936,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -3289,15 +3957,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 = { @@ -3317,6 +3985,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -3329,9 +4008,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 = { @@ -3346,6 +4025,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -3353,14 +4037,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 = { @@ -3373,6 +4057,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3382,14 +4076,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 = { @@ -3402,6 +4096,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3411,24 +4115,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 = { @@ -3447,6 +4151,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -3462,8 +4186,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 = { @@ -3474,6 +4198,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -3483,20 +4211,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 = { @@ -3515,6 +4243,24 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.resource_access_rules = kwargs.get('resource_access_rules', None) @@ -3526,8 +4272,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 = { @@ -3538,6 +4284,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3559,14 +4309,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 = { @@ -3592,6 +4342,16 @@ def __init__( self, **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 @@ -3603,12 +4363,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 = { @@ -3620,6 +4380,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3630,15 +4398,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 = { @@ -3657,6 +4425,17 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3667,14 +4446,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 = { @@ -3688,6 +4467,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3698,14 +4487,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 = { @@ -3719,6 +4508,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3729,8 +4528,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 = { @@ -3741,6 +4540,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3766,6 +4569,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3783,11 +4588,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". @@ -3815,6 +4620,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3824,8 +4637,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 = { @@ -3836,6 +4649,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3857,8 +4674,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 = { @@ -3882,6 +4699,10 @@ def __init__( self, **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 @@ -3891,8 +4712,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 = { @@ -3903,6 +4724,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3910,15 +4735,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 = { @@ -3931,6 +4756,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -3940,8 +4776,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 = { @@ -3952,6 +4788,10 @@ def __init__( self, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_04_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = kwargs.get('smb', None) @@ -3969,10 +4809,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 = { @@ -3992,6 +4832,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -3999,10 +4845,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 = { @@ -4014,6 +4860,12 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.resource_id = kwargs.get('resource_id', None) @@ -4026,11 +4878,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. @@ -4055,6 +4907,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -4072,11 +4931,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 = { @@ -4094,6 +4953,13 @@ def __init__( self, **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 @@ -4103,15 +4969,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 = { @@ -4124,6 +4990,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -4135,11 +5012,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 = { @@ -4156,6 +5033,13 @@ def __init__( self, **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 = kwargs['sas_expiration_period'] self.expiration_action = kwargs.get('expiration_action', "Log") @@ -4166,49 +5050,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 = { @@ -4241,6 +5124,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -4265,8 +5194,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 = { @@ -4277,6 +5207,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -4284,10 +5219,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 = { @@ -4299,6 +5234,12 @@ def __init__( self, **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 = kwargs.get('id', None) self.access_policy = kwargs.get('access_policy', None) @@ -4311,11 +5252,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 @@ -4335,6 +5276,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4366,6 +5314,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4378,11 +5328,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 @@ -4397,9 +5347,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 = { @@ -4425,6 +5375,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4438,20 +5398,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 = { @@ -4466,6 +5426,22 @@ def __init__( self, **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 = kwargs.get('multichannel', None) self.versions = kwargs.get('versions', None) @@ -4489,10 +5465,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 = { @@ -4514,6 +5490,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -4534,19 +5516,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 @@ -4591,51 +5573,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 = { @@ -4713,6 +5695,49 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4757,8 +5782,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 @@ -4780,6 +5805,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4789,76 +5818,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 = { @@ -4896,6 +5925,78 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -4954,6 +6055,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -4995,6 +6098,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -5024,6 +6129,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -5054,6 +6161,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5100,6 +6209,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5114,9 +6225,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 = { @@ -5131,6 +6242,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -5138,65 +6254,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 = { @@ -5224,6 +6339,68 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -5258,8 +6435,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. @@ -5285,6 +6462,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -5311,6 +6492,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5318,20 +6501,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 = { @@ -5347,6 +6530,22 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -5391,6 +6590,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5408,10 +6609,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 = { @@ -5431,6 +6632,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -5440,14 +6647,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 = { @@ -5466,6 +6673,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -5509,6 +6726,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5561,6 +6780,8 @@ def __init__( self, **kwargs ): + """ + """ super(UpdateHistoryProperty, self).__init__(**kwargs) self.update = None self.immutability_period_since_creation_in_days = None @@ -5604,6 +6825,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5614,8 +6837,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 = { @@ -5626,6 +6849,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -5655,6 +6882,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5685,6 +6914,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5695,15 +6926,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 = { @@ -5720,6 +6951,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 606d5e5a1d723..c1cb0392e6bf3 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 1ead554d9a0e1..ddc0a65da3fcb 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 462b148f34db5..792a5ad36f4e8 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,26 +5,617 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_object_level_worm_request_initial( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -47,6 +638,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -85,42 +677,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,11 +727,13 @@ 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 @@ -180,33 +771,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,8 +805,11 @@ 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 @@ -262,33 +846,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,8 +876,11 @@ 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 @@ -336,28 +913,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,8 +938,11 @@ 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 @@ -405,26 +975,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,6 +999,8 @@ 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 @@ -474,33 +1038,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,8 +1068,11 @@ 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 @@ -552,33 +1109,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,8 +1139,11 @@ 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 @@ -636,40 +1186,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,14 +1216,18 @@ 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 @@ -725,32 +1266,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,14 +1288,18 @@ 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 @@ -808,31 +1340,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,14 +1362,18 @@ 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 @@ -888,29 +1412,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,14 +1434,18 @@ 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 @@ -971,37 +1489,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,14 +1519,18 @@ 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 @@ -1055,36 +1567,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,8 +1600,10 @@ 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 @@ -1113,28 +1617,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1147,6 +1641,8 @@ 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 @@ -1174,15 +1670,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 +1695,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 +1714,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 559fe8fd21d4e..26d06a93d2876 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 c321fb09b5b29..a16e179f25135 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 d90b552d047fc..e375afdfe0e98 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,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +130,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.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 +141,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,17 +176,19 @@ 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 @@ -136,33 +212,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 +237,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 47ba688bd9305..bea4089585c69 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 847af5abe28ca..a00fcad972e12 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 537b68343d8fd..381a1a985aefe 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,24 +5,342 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', None) # type: Optional[str] + include = kwargs.pop('include', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +363,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +402,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,17 +447,19 @@ 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 @@ -183,41 +501,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,8 +537,11 @@ 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 @@ -268,39 +578,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,8 +609,11 @@ 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 @@ -350,38 +653,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,8 +681,11 @@ 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 @@ -435,38 +729,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,6 +756,8 @@ 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 @@ -509,39 +793,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,6 +823,8 @@ 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 @@ -588,52 +864,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 dff12b3f4a8b1..cfa99bf38881c 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 e153de6c391b1..46d8b07a1c291 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -156,34 +320,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,8 +346,11 @@ 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 @@ -230,39 +387,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +418,11 @@ 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 @@ -305,37 +455,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 3cbe4e47dcade..4fcb9d8b72097 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 e3c7884137453..2f286529eba56 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,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), - '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 96c1bcd61f0e1..60b6b0f3e4d33 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 44906a1016c43..2d0269bf0c4bd 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,39 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +323,11 @@ 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 @@ -158,39 +363,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,8 +394,11 @@ 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 @@ -233,34 +431,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,8 +457,11 @@ 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 @@ -303,34 +494,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,6 +519,8 @@ 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 @@ -372,40 +555,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 +598,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 ba140d41bbf69..f8ac7caaa2d3b 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 ef843343efbfd..cc3a4f0f640bf 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 78e7c7f39bb0c..e19a05126d818 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,26 +5,546 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +567,7 @@ 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" @@ -58,7 +579,8 @@ 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 @@ -69,30 +591,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] + + _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,8 +618,10 @@ 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 @@ -121,32 +635,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +666,11 @@ 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 @@ -188,15 +695,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 +719,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,8 +745,10 @@ 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 @@ -268,25 +775,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,6 +798,8 @@ 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 @@ -332,29 +833,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,8 +858,11 @@ 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 @@ -406,32 +899,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,8 +928,11 @@ 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 @@ -456,8 +942,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.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 +953,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,11 +993,13 @@ 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 @@ -528,8 +1013,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 +1024,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,11 +1066,13 @@ 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 @@ -606,7 +1091,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 +1104,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,8 +1129,11 @@ 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 @@ -675,7 +1153,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 +1165,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,8 +1194,11 @@ 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 @@ -756,32 +1228,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,8 +1257,11 @@ 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 @@ -826,32 +1291,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,8 +1320,10 @@ 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 @@ -879,25 +1336,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1359,8 @@ 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 @@ -930,15 +1381,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 +1405,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,6 +1424,7 @@ 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( @@ -993,32 +1440,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1036,8 +1473,11 @@ 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 @@ -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,8 +1549,10 @@ 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 @@ -1139,25 +1579,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 +1601,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 60a76598f6875..c034b27470100 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,34 +273,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,8 +299,11 @@ 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 @@ -145,34 +335,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,8 +361,11 @@ 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 @@ -214,34 +397,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,8 +423,11 @@ 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 @@ -283,34 +459,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,6 +484,8 @@ 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 @@ -344,36 +512,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 +551,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 fb13e93a213f8..05e7a7c34aa65 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 dead9f7bf1872..064ce54db79d3 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 a50d1e1c39a72..1072dc1031610 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 8c02e8f6f6249..57b18978d7879 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 @@ -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 ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION @@ -40,11 +40,11 @@ def __init__( **kwargs # type: Any ): # type: (...) -> 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 +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/v2021_06_01/_metadata.json b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/_metadata.json index 5c2931eb4a709..8db940af1b699 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 0000000000000..74e48ecd07cf3 --- /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 94287daed865c..f631ac835aa65 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,40 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from copy import deepcopy from typing import TYPE_CHECKING 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 - + from azure.core.rest import HttpRequest, HttpResponse class StorageManagementClient(object): """The Azure Storage Management API. @@ -55,17 +37,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 +74,74 @@ 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] + base_url="https://management.azure.com", # type: str **kwargs # type: Any ): # type: (...) -> 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 = 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 232662316d4da..e5754a47ce68f 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 9cfe0ace1ba97..3b85e3279ea77 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 480fd3067ddf2..631e67ed515d6 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 0000000000000..74e48ecd07cf3 --- /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 367b5f44657b3..8912b515f2c84 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 172f9af84cdb6..cfc6a8b47ba0c 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 b7a5ce46e6fc5..9ff36f3f94ee3 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 f0fbc55dbce3f..16d106740df14 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 49f4da0cb024e..b954fac898f70 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 52d2223b17f07..aa099fa4ed890 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 ddd8fb80b7032..8d1f1a0d7b4f8 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 ac5907431bc46..025fb3ca1bfba 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 03fd46c48440a..d5a24b15f07c8 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 506bafc80e946..df23468afd4c1 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 133a07c0c9850..1b26e3486aacc 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 ee226514b9952..3716af82c8e45 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 b6f32442c7503..97bca9a0194e4 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 11c52db9f1032..52d4d2f5f3986 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 5a8fd0891c6e4..f804cdbadbfbd 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 450186f16430d..4a93470588266 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 326fdd9c4230c..79b6bac23f8e8 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 634b8f9b649d2..67f077bd90d64 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 dbd68eb1ef0c4..883e0ff08850a 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 6b592ccc48280..fda99797eccd6 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/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_06_01/models/_models.py index df1e7ef924c7f..efa0d8c233c82 100644 --- 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 @@ -13,12 +13,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 = { @@ -31,6 +31,14 @@ def __init__( self, **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 = kwargs.get('start_time', None) self.expiry_time = kwargs.get('expiry_time', None) @@ -40,22 +48,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 = { @@ -72,6 +80,24 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = kwargs.get('state', None) @@ -83,31 +109,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 = { @@ -132,6 +158,34 @@ def __init__( self, **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 = kwargs['services'] self.resource_types = kwargs['resource_types'] @@ -148,19 +202,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 = { @@ -185,6 +239,22 @@ def __init__( self, **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 = kwargs['domain_name'] self.net_bios_domain_name = kwargs['net_bios_domain_name'] @@ -225,6 +295,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -266,6 +338,8 @@ def __init__( self, **kwargs ): + """ + """ super(AzureEntityResource, self).__init__(**kwargs) self.etag = None @@ -275,18 +349,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 """ @@ -304,6 +378,21 @@ def __init__( self, **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 = kwargs['directory_service_options'] self.active_directory_properties = kwargs.get('active_directory_properties', None) @@ -333,15 +422,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", @@ -353,8 +442,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 @@ -369,15 +458,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 = { @@ -429,6 +518,28 @@ def __init__( self, **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 @@ -468,9 +579,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 = { @@ -494,6 +604,11 @@ def __init__( self, **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 @@ -505,19 +620,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, @@ -527,7 +642,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 = { @@ -549,6 +664,31 @@ def __init__( self, **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 = kwargs.get('filters', None) self.format = kwargs['format'] @@ -560,20 +700,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 = { @@ -587,6 +727,22 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs.get('blob_types', None) @@ -599,16 +755,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 = { @@ -629,6 +785,18 @@ def __init__( self, **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 = kwargs['enabled'] self.name = kwargs['name'] @@ -641,13 +809,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 = { @@ -666,6 +834,15 @@ def __init__( self, **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 = kwargs['enabled'] self.type = kwargs['type'] @@ -677,10 +854,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 = { @@ -697,6 +874,12 @@ def __init__( self, **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 = kwargs['time_to_restore'] self.blob_ranges = kwargs['blob_ranges'] @@ -707,10 +890,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 = { @@ -727,6 +910,12 @@ def __init__( self, **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 = kwargs['start_range'] self.end_range = kwargs['end_range'] @@ -768,6 +957,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobRestoreStatus, self).__init__(**kwargs) self.status = None self.failure_reason = None @@ -796,6 +987,8 @@ def __init__( self, **kwargs ): + """ + """ super(BlobServiceItems, self).__init__(**kwargs) self.value = None @@ -815,31 +1008,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 """ @@ -870,6 +1062,36 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -886,12 +1108,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 = { @@ -907,6 +1129,14 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.retention_in_days = kwargs.get('retention_in_days', None) @@ -945,6 +1175,8 @@ def __init__( self, **kwargs ): + """ + """ super(CheckNameAvailabilityResult, self).__init__(**kwargs) self.name_available = None self.reason = None @@ -954,8 +1186,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 = { @@ -966,6 +1198,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -973,17 +1209,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 = { @@ -997,6 +1233,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1007,17 +1256,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 = { @@ -1031,6 +1280,19 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1043,22 +1305,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 = { @@ -1081,6 +1343,24 @@ def __init__( self, **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 = kwargs['allowed_origins'] self.allowed_methods = kwargs['allowed_methods'] @@ -1092,9 +1372,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 = { @@ -1105,6 +1385,11 @@ def __init__( self, **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 = kwargs.get('cors_rules', None) @@ -1114,12 +1399,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 = { @@ -1135,6 +1420,14 @@ def __init__( self, **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 = kwargs['name'] self.use_sub_domain_name = kwargs.get('use_sub_domain_name', None) @@ -1145,9 +1438,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 = { @@ -1162,6 +1455,11 @@ def __init__( self, **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 = kwargs['days_after_creation_greater_than'] @@ -1169,13 +1467,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 = { @@ -1192,6 +1490,15 @@ def __init__( self, **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 = 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) @@ -1228,6 +1535,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1283,6 +1592,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccount, self).__init__(**kwargs) self.storage_account_resource_id = None self.location = None @@ -1317,6 +1628,8 @@ def __init__( self, **kwargs ): + """ + """ super(DeletedAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1327,12 +1640,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 = { @@ -1349,6 +1662,14 @@ def __init__( self, **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 = kwargs['deleted_share_name'] self.deleted_share_version = kwargs['deleted_share_version'] @@ -1357,11 +1678,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 = { @@ -1377,6 +1698,13 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.days = kwargs.get('days', None) @@ -1385,10 +1713,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 = { @@ -1400,6 +1728,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -1410,19 +1744,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 = { @@ -1441,6 +1775,21 @@ def __init__( self, **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 = kwargs.get('services', None) self.key_source = kwargs.get('key_source', "Microsoft.Storage") @@ -1452,9 +1801,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 = { @@ -1465,6 +1814,11 @@ def __init__( self, **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 = kwargs.get('encryption_user_assigned_identity', None) @@ -1482,25 +1836,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 = { @@ -1527,6 +1881,22 @@ def __init__( self, **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 = kwargs.get('source', None) self.state = kwargs.get('state', None) @@ -1541,10 +1911,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 @@ -1567,6 +1937,12 @@ def __init__( self, **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 = kwargs.get('key_uri', None) self.current_versioned_key_identifier = None @@ -1599,6 +1975,8 @@ def __init__( self, **kwargs ): + """ + """ super(EncryptionScopeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1609,17 +1987,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 = { @@ -1636,6 +2014,15 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.last_enabled_time = None @@ -1645,14 +2032,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 = { @@ -1666,6 +2053,16 @@ def __init__( self, **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 = kwargs.get('blob', None) self.file = kwargs.get('file', None) @@ -1690,11 +2087,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 """ @@ -1722,6 +2119,14 @@ def __init__( self, **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 @@ -1736,8 +2141,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 = { @@ -1748,6 +2153,10 @@ def __init__( self, **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 = kwargs.get('error', None) @@ -1755,12 +2164,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 = { @@ -1772,6 +2181,14 @@ def __init__( self, **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 = kwargs.get('code', None) self.message = kwargs.get('message', None) @@ -1780,10 +2197,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 = { @@ -1795,6 +2212,12 @@ def __init__( self, **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 = kwargs.get('name', None) self.type = kwargs.get('type', None) @@ -1821,6 +2244,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileServiceItems, self).__init__(**kwargs) self.value = None @@ -1840,15 +2265,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 = { @@ -1872,6 +2297,17 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -1896,17 +2332,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. @@ -1915,10 +2351,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. @@ -1935,8 +2371,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 @@ -1991,6 +2427,25 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -2029,17 +2484,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. @@ -2048,10 +2503,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. @@ -2068,8 +2523,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 @@ -2124,6 +2579,25 @@ def __init__( self, **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 = kwargs.get('metadata', None) @@ -2171,6 +2645,8 @@ def __init__( self, **kwargs ): + """ + """ super(FileShareItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -2214,6 +2690,8 @@ def __init__( self, **kwargs ): + """ + """ super(GeoReplicationStats, self).__init__(**kwargs) self.status = None self.last_sync_time = None @@ -2231,13 +2709,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] """ @@ -2258,6 +2736,16 @@ def __init__( self, **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 @@ -2280,25 +2768,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 = { @@ -2324,6 +2812,24 @@ def __init__( self, **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 = kwargs.get('immutability_period_since_creation_in_days', None) self.state = None @@ -2340,25 +2846,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 = { @@ -2380,6 +2886,24 @@ def __init__( self, **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 @@ -2392,15 +2916,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 """ @@ -2413,6 +2937,18 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.immutability_policy = kwargs.get('immutability_policy', None) @@ -2423,9 +2959,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 @@ -2448,6 +2984,11 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.time_stamp = None @@ -2459,12 +3000,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 = { @@ -2480,6 +3021,14 @@ def __init__( self, **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 = kwargs['ip_address_or_range'] self.action = kwargs.get('action', None) @@ -2488,10 +3037,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 = { @@ -2503,6 +3052,12 @@ def __init__( self, **kwargs ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ super(KeyCreationTime, self).__init__(**kwargs) self.key1 = kwargs.get('key1', None) self.key2 = kwargs.get('key2', None) @@ -2513,8 +3068,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 = { @@ -2529,6 +3084,10 @@ def __init__( self, **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 = kwargs['key_expiration_period_in_days'] @@ -2538,12 +3097,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 @@ -2568,6 +3127,14 @@ def __init__( self, **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 = kwargs.get('key_name', None) self.key_version = kwargs.get('key_version', None) @@ -2581,18 +3148,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 = { @@ -2610,6 +3177,20 @@ def __init__( self, **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 = kwargs['enable'] self.name = kwargs.get('name', None) @@ -2622,20 +3203,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 = { @@ -2654,6 +3235,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2665,11 +3262,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 = { @@ -2681,6 +3278,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2691,20 +3295,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 = { @@ -2723,6 +3327,22 @@ def __init__( self, **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 = kwargs['action'] self.lease_id = kwargs.get('lease_id', None) @@ -2734,11 +3354,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 = { @@ -2750,6 +3370,13 @@ def __init__( self, **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 = kwargs.get('lease_id', None) self.lease_time_seconds = kwargs.get('lease_time_seconds', None) @@ -2767,13 +3394,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 = { @@ -2791,6 +3418,15 @@ def __init__( self, **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 = kwargs['tags'] @@ -2807,10 +3443,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 """ @@ -2828,6 +3464,13 @@ def __init__( self, **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 = kwargs.get('tags', None) @@ -2855,6 +3498,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListAccountSasResponse, self).__init__(**kwargs) self.account_sas_token = None @@ -2880,6 +3525,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListBlobInventoryPolicy, self).__init__(**kwargs) self.value = None @@ -2907,15 +3554,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", @@ -2927,8 +3574,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 @@ -2943,15 +3590,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 = { @@ -3003,6 +3650,28 @@ def __init__( self, **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 @@ -3051,6 +3720,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListContainerItems, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3069,8 +3740,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 = { @@ -3090,6 +3761,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(ListQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) @@ -3119,6 +3794,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3145,6 +3822,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListQueueServices, self).__init__(**kwargs) self.value = None @@ -3170,6 +3849,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListServiceSasResponse, self).__init__(**kwargs) self.service_sas_token = None @@ -3199,6 +3880,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableResource, self).__init__(**kwargs) self.value = None self.next_link = None @@ -3225,6 +3908,8 @@ def __init__( self, **kwargs ): + """ + """ super(ListTableServices, self).__init__(**kwargs) self.value = None @@ -3244,9 +3929,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 = { @@ -3268,6 +3953,11 @@ def __init__( self, **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 = kwargs.get('policy', None) @@ -3276,12 +3966,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 = { @@ -3294,6 +3984,14 @@ def __init__( self, **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 = kwargs.get('base_blob', None) self.snapshot = kwargs.get('snapshot', None) @@ -3303,18 +4001,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 = { @@ -3328,6 +4025,20 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3340,10 +4051,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 = { @@ -3359,6 +4070,12 @@ def __init__( self, **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 = kwargs['actions'] self.filters = kwargs.get('filters', None) @@ -3369,14 +4086,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 = { @@ -3393,6 +4110,16 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.blob_types = kwargs['blob_types'] @@ -3404,15 +4131,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 = { @@ -3432,6 +4159,17 @@ def __init__( self, **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 = kwargs.get('enabled', None) self.name = kwargs['name'] @@ -3444,9 +4182,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 = { @@ -3461,6 +4199,11 @@ def __init__( self, **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 = kwargs['rules'] @@ -3468,14 +4211,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 = { @@ -3488,6 +4231,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3497,14 +4250,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 = { @@ -3517,6 +4270,16 @@ def __init__( self, **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 = kwargs.get('tier_to_cool', None) self.tier_to_archive = kwargs.get('tier_to_archive', None) @@ -3526,24 +4289,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 = { @@ -3562,6 +4325,26 @@ def __init__( self, **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 = kwargs.get('name', None) self.display_name = kwargs.get('display_name', None) @@ -3577,8 +4360,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 = { @@ -3589,6 +4372,10 @@ def __init__( self, **kwargs ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ super(Multichannel, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) @@ -3598,20 +4385,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 = { @@ -3630,6 +4417,24 @@ def __init__( self, **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 = kwargs.get('bypass', "AzureServices") self.resource_access_rules = kwargs.get('resource_access_rules', None) @@ -3641,8 +4446,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 = { @@ -3653,6 +4458,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3674,14 +4483,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 = { @@ -3707,6 +4516,16 @@ def __init__( self, **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 @@ -3718,12 +4537,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 = { @@ -3735,6 +4554,14 @@ def __init__( self, **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 = kwargs.get('prefix_match', None) self.min_creation_time = kwargs.get('min_creation_time', None) @@ -3745,15 +4572,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 = { @@ -3772,6 +4599,17 @@ def __init__( self, **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 = kwargs.get('rule_id', None) self.source_container = kwargs['source_container'] @@ -3782,14 +4620,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 = { @@ -3803,6 +4641,16 @@ def __init__( self, **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 = kwargs.get('name', None) self.display = kwargs.get('display', None) @@ -3813,14 +4661,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 = { @@ -3834,6 +4682,16 @@ def __init__( self, **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 = kwargs.get('provider', None) self.resource = kwargs.get('resource', None) @@ -3844,8 +4702,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 = { @@ -3856,6 +4714,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3881,6 +4743,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -3898,11 +4762,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". @@ -3930,6 +4794,14 @@ def __init__( self, **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 = kwargs.get('private_endpoint', None) self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) @@ -3939,8 +4811,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 = { @@ -3951,6 +4823,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -3972,8 +4848,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 = { @@ -3997,6 +4873,10 @@ def __init__( self, **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 @@ -4006,8 +4886,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 = { @@ -4018,6 +4898,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -4025,15 +4909,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 = { @@ -4046,6 +4930,17 @@ def __init__( self, **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 = kwargs.get('status', None) self.description = kwargs.get('description', None) @@ -4057,10 +4952,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 """ @@ -4078,6 +4973,12 @@ def __init__( self, **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 = kwargs.get('allow_protected_append_writes_all', None) self.timestamp = None @@ -4086,8 +4987,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 = { @@ -4098,6 +4999,10 @@ def __init__( self, **kwargs ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_06_01.models.SmbSetting + """ super(ProtocolSettings, self).__init__(**kwargs) self.smb = kwargs.get('smb', None) @@ -4115,10 +5020,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 = { @@ -4138,6 +5043,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -4145,10 +5056,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 = { @@ -4160,6 +5071,12 @@ def __init__( self, **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 = kwargs.get('tenant_id', None) self.resource_id = kwargs.get('resource_id', None) @@ -4172,11 +5089,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. @@ -4201,6 +5118,13 @@ def __init__( self, **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 = kwargs['enabled'] self.days = kwargs.get('days', None) @@ -4218,11 +5142,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 = { @@ -4240,6 +5164,13 @@ def __init__( self, **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 @@ -4249,15 +5180,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 = { @@ -4270,6 +5201,17 @@ def __init__( self, **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 = kwargs.get('routing_choice', None) self.publish_microsoft_endpoints = kwargs.get('publish_microsoft_endpoints', None) @@ -4281,11 +5223,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 = { @@ -4302,6 +5244,13 @@ def __init__( self, **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 = kwargs['sas_expiration_period'] self.expiration_action = kwargs.get('expiration_action', "Log") @@ -4312,49 +5261,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 = { @@ -4387,6 +5335,52 @@ def __init__( self, **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 = kwargs['canonicalized_resource'] self.resource = kwargs.get('resource', None) @@ -4411,8 +5405,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 = { @@ -4423,6 +5418,11 @@ def __init__( self, **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 = kwargs.get('metric_specifications', None) @@ -4430,10 +5430,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 = { @@ -4445,6 +5445,12 @@ def __init__( self, **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 = kwargs.get('id', None) self.access_policy = kwargs.get('access_policy', None) @@ -4457,11 +5463,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 @@ -4481,6 +5487,13 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4512,6 +5525,8 @@ def __init__( self, **kwargs ): + """ + """ super(SKUCapability, self).__init__(**kwargs) self.name = None self.value = None @@ -4524,11 +5539,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 @@ -4543,9 +5558,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 = { @@ -4571,6 +5586,16 @@ def __init__( self, **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 = kwargs['name'] self.tier = None @@ -4584,20 +5609,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 = { @@ -4612,6 +5637,22 @@ def __init__( self, **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 = kwargs.get('multichannel', None) self.versions = kwargs.get('versions', None) @@ -4635,10 +5676,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 = { @@ -4660,6 +5701,12 @@ def __init__( self, **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 = kwargs.get('tags', None) self.location = kwargs['location'] @@ -4680,19 +5727,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 @@ -4737,62 +5784,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 """ @@ -4874,6 +5922,62 @@ def __init__( self, **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__(**kwargs) self.sku = None self.kind = None @@ -4921,8 +6025,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 @@ -4944,6 +6048,10 @@ def __init__( self, **kwargs ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ super(StorageAccountCheckNameAvailabilityParameters, self).__init__(**kwargs) self.name = kwargs['name'] @@ -4953,87 +6061,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 """ @@ -5075,6 +6184,91 @@ def __init__( self, **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 = kwargs['sku'] self.kind = kwargs['kind'] @@ -5136,6 +6330,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountInternetEndpoints, self).__init__(**kwargs) self.blob = None self.file = None @@ -5177,6 +6373,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountKey, self).__init__(**kwargs) self.key_name = None self.value = None @@ -5206,6 +6404,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListKeysResult, self).__init__(**kwargs) self.keys = None @@ -5236,6 +6436,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -5282,6 +6484,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageAccountMicrosoftEndpoints, self).__init__(**kwargs) self.blob = None self.queue = None @@ -5296,9 +6500,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 = { @@ -5313,6 +6517,11 @@ def __init__( self, **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 = kwargs['key_name'] @@ -5320,76 +6529,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 """ @@ -5421,6 +6630,81 @@ def __init__( self, **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 = kwargs.get('sku', None) self.tags = kwargs.get('tags', None) @@ -5458,8 +6742,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. @@ -5485,6 +6769,10 @@ def __init__( self, **kwargs ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ super(StorageQueue, self).__init__(**kwargs) self.metadata = kwargs.get('metadata', None) self.approximate_message_count = None @@ -5511,6 +6799,8 @@ def __init__( self, **kwargs ): + """ + """ super(StorageSkuListResult, self).__init__(**kwargs) self.value = None @@ -5518,20 +6808,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 = { @@ -5547,6 +6837,22 @@ def __init__( self, **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 = kwargs.get('created_by', None) self.created_by_type = kwargs.get('created_by_type', None) @@ -5591,6 +6897,8 @@ def __init__( self, **kwargs ): + """ + """ super(Table, self).__init__(**kwargs) self.table_name = None @@ -5608,10 +6916,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 = { @@ -5631,6 +6939,12 @@ def __init__( self, **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 = kwargs.get('cors', None) @@ -5640,14 +6954,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 = { @@ -5666,6 +6980,16 @@ def __init__( self, **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 = kwargs['name'] self.op = kwargs['op'] @@ -5709,6 +7033,8 @@ def __init__( self, **kwargs ): + """ + """ super(TagProperty, self).__init__(**kwargs) self.tag = None self.timestamp = None @@ -5737,19 +7063,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 = { @@ -5776,6 +7102,21 @@ def __init__( self, **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 @@ -5821,6 +7162,8 @@ def __init__( self, **kwargs ): + """ + """ super(Usage, self).__init__(**kwargs) self.unit = None self.current_value = None @@ -5831,8 +7174,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 = { @@ -5843,6 +7186,10 @@ def __init__( self, **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 = kwargs.get('value', None) @@ -5872,6 +7219,8 @@ def __init__( self, **kwargs ): + """ + """ super(UsageName, self).__init__(**kwargs) self.value = None self.localized_value = None @@ -5902,6 +7251,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -5912,15 +7263,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 = { @@ -5937,6 +7288,17 @@ def __init__( self, **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 = kwargs['virtual_network_resource_id'] self.action = kwargs.get('action', 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 59c6c288ff9dc..ce59dceddf5ff 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 fc867e84f0628..c7bf893a88f02 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 c992b0cbd4351..6d348aa75af51 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,26 +5,617 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_object_level_worm_request_initial( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobContainersOperations(object): """BlobContainersOperations operations. @@ -47,6 +638,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -85,42 +677,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,11 +727,13 @@ 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 @@ -180,33 +771,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,8 +805,11 @@ 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 @@ -262,33 +846,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,8 +876,11 @@ 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 @@ -336,28 +913,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,8 +938,11 @@ 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 @@ -405,26 +975,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,6 +999,8 @@ 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 @@ -474,33 +1038,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,8 +1068,11 @@ 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 @@ -552,33 +1109,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,8 +1139,11 @@ 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 @@ -636,40 +1186,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,14 +1216,18 @@ 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 @@ -725,32 +1266,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,14 +1288,18 @@ 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 @@ -808,31 +1340,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,14 +1362,18 @@ 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 @@ -888,29 +1412,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,14 +1434,18 @@ 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 @@ -971,37 +1489,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,14 +1519,18 @@ 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 @@ -1055,36 +1567,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,8 +1600,10 @@ 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 @@ -1113,28 +1617,18 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1147,6 +1641,8 @@ 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 @@ -1174,15 +1670,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 +1695,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 +1714,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 a4a20167ddfc0..dd5908aa24e4a 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobInventoryPoliciesOperations(object): """BlobInventoryPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -64,7 +227,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 +239,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,8 +265,11 @@ 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 @@ -133,7 +290,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 +304,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,8 +335,11 @@ 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 @@ -208,7 +359,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 +371,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,6 +396,8 @@ 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 @@ -271,8 +415,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 +426,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 +465,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 9169cd28d4a66..19f2a0d0883ba 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,24 +5,148 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class BlobServicesOperations(object): """BlobServicesOperations operations. @@ -45,6 +169,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -71,36 +196,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,11 +240,13 @@ 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 @@ -154,34 +278,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] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_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 @@ -195,8 +307,11 @@ 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 @@ -224,29 +339,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 +363,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 24e0c28d04221..77cfbb51726b1 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,24 +5,100 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class DeletedAccountsOperations(object): """DeletedAccountsOperations operations. @@ -45,6 +121,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +130,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.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 +141,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,17 +176,19 @@ 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 @@ -136,33 +212,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 +237,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 ffa54c69dd193..a4c226d3b846d 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,24 +5,190 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class EncryptionScopesOperations(object): """EncryptionScopesOperations operations. @@ -45,6 +211,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def put( self, resource_group_name, # type: str @@ -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,8 +284,11 @@ 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 @@ -165,39 +325,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,8 +356,11 @@ 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 @@ -240,34 +393,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,8 +419,11 @@ 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 @@ -295,8 +441,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 +452,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 +496,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 0ebb435eb31f0..cfc3474194dd0 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class FileServicesOperations(object): """FileServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 ee6d098cdab5a..7593c08301a45 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,24 +5,342 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', None) # type: Optional[str] + include = kwargs.pop('include', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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, + **kwargs + ) + +# fmt: on class FileSharesOperations(object): """FileSharesOperations operations. @@ -45,6 +363,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -83,42 +402,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,17 +447,19 @@ 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 @@ -183,41 +501,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,8 +537,11 @@ 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 @@ -268,39 +578,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,8 +609,11 @@ 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 @@ -350,38 +653,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,8 +681,11 @@ 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 @@ -435,38 +729,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,6 +756,8 @@ 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 @@ -509,39 +793,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,6 +823,8 @@ 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 @@ -588,52 +864,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 d6a65327a0043..ae68c90712420 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,23 +5,143 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ManagementPoliciesOperations(object): """ManagementPoliciesOperations operations. @@ -44,6 +164,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, resource_group_name, # type: str @@ -63,7 +184,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 +196,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,8 +221,11 @@ 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 @@ -131,7 +246,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 +260,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,8 +290,11 @@ 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 @@ -205,7 +314,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 +326,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 +349,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 8483558c732b6..4c2ee063d5b65 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class ObjectReplicationPoliciesOperations(object): """ObjectReplicationPoliciesOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,17 +275,19 @@ 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 @@ -156,34 +320,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,8 +346,11 @@ 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 @@ -230,39 +387,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +418,11 @@ 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 @@ -305,37 +455,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 87ce91d6dabfe..7b43e0959501f 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,24 +5,58 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class Operations(object): """Operations operations. @@ -45,6 +79,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -54,7 +89,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.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 +98,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 +136,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 5ace766fd21c3..13df0f5113421 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,24 +5,186 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -45,6 +207,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -62,8 +225,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 +236,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,11 +280,13 @@ 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 @@ -153,34 +317,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,8 +343,11 @@ 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 @@ -224,39 +381,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +412,11 @@ 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 @@ -297,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), - '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 e168aa3b06a21..40f3595e7463f 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,23 +5,67 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -44,6 +88,7 @@ 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 @@ -70,27 +115,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') - # 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -104,4 +139,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 3af976e8c8a6a..4f58f5981bb13 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,24 +5,235 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on class QueueOperations(object): """QueueOperations operations. @@ -45,6 +256,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -80,39 +292,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +323,11 @@ 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 @@ -158,39 +363,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,8 +394,11 @@ 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 @@ -233,34 +431,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,8 +457,11 @@ 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 @@ -303,34 +494,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,6 +519,8 @@ 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 @@ -372,40 +555,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 +598,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 779f6d26cbaf0..787e29645cc89 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class QueueServicesOperations(object): """QueueServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 eebde5adeaa66..35de1e5504c5d 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,24 +5,64 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class SkusOperations(object): """SkusOperations operations. @@ -45,6 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs # type: Any @@ -53,8 +94,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.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 +105,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 +145,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 a8a7e3f6f67b8..ff12b5d25e905 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,26 +5,621 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + request_type = kwargs.pop('request_type') # type: 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class StorageAccountsOperations(object): """StorageAccountsOperations operations. @@ -47,6 +642,7 @@ 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" @@ -58,7 +654,8 @@ 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 @@ -69,30 +666,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,8 +693,10 @@ 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 @@ -121,32 +710,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -162,8 +741,11 @@ 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 @@ -188,15 +770,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 +794,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,8 +820,10 @@ 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 @@ -268,25 +850,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,6 +873,8 @@ 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 @@ -332,29 +908,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,8 +933,11 @@ 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 @@ -406,32 +974,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,8 +1003,11 @@ 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 @@ -456,8 +1017,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.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 +1028,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,11 +1068,13 @@ 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 @@ -528,8 +1088,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 +1099,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,11 +1141,13 @@ 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 @@ -606,7 +1166,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 +1179,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,8 +1204,11 @@ 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 @@ -675,7 +1228,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 +1240,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,8 +1269,11 @@ 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 @@ -756,32 +1303,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,8 +1332,11 @@ 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 @@ -826,32 +1366,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,8 +1395,10 @@ 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 @@ -879,25 +1411,17 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -910,6 +1434,8 @@ 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 @@ -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,6 +1499,7 @@ 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( @@ -993,41 +1515,32 @@ 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 = 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 @@ -1052,15 +1565,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 +1590,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,6 +1609,7 @@ 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( @@ -1115,40 +1624,31 @@ 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 = 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 @@ -1167,15 +1667,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 +1691,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,6 +1710,7 @@ 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( @@ -1230,32 +1726,22 @@ 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1273,8 +1759,11 @@ 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 @@ -1296,15 +1785,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 +1809,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,8 +1835,10 @@ 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 @@ -1376,25 +1865,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 +1887,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 4ecdea47a6154..65ca95dc16245 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,24 +5,220 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableOperations(object): """TableOperations operations. @@ -45,6 +241,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def create( self, resource_group_name, # type: str @@ -76,34 +273,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,8 +299,11 @@ 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 @@ -145,34 +335,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,8 +361,11 @@ 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 @@ -214,34 +397,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,8 +423,11 @@ 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 @@ -283,34 +459,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,6 +484,8 @@ 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 @@ -344,36 +512,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 +551,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 fd02c93d04b82..b660f5b47e2b5 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,23 +5,147 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class TableServicesOperations(object): """TableServicesOperations operations. @@ -44,6 +168,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name, # type: str @@ -70,33 +195,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') + + 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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +220,11 @@ 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 @@ -138,40 +256,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] + + _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 = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response if response.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,8 +286,11 @@ 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 @@ -209,35 +318,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 +343,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 242d70b8225f5..b2f34775d5d15 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,24 +5,66 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import TYPE_CHECKING import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.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 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]] +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on class UsagesOperations(object): """UsagesOperations operations. @@ -45,6 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_location( self, location, # type: str @@ -66,35 +109,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 +151,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 0000000000000..1072dc1031610 --- /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 0000000000000..2c2eb253ea5b8 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import 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 + + +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, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..692b8bf846e44 --- /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 0000000000000..74e48ecd07cf3 --- /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 0000000000000..de36d25935aae --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/_storage_management_client.py @@ -0,0 +1,160 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING + +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 typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.rest import HttpRequest, HttpResponse + +class StorageManagementClient(object): + """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, # type: "TokenCredential" + subscription_id, # type: str + base_url="https://management.azure.com", # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 # type: Any + ): + # type: (...) -> 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 0000000000000..138f663c53a4e --- /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 0000000000000..e5754a47ce68f --- /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 0000000000000..3b85e3279ea77 --- /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 0000000000000..b9ef2874d4931 --- /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 0000000000000..74e48ecd07cf3 --- /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 0000000000000..e2ecd0cc2d91e --- /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 0000000000000..4c1064ae3825e --- /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 0000000000000..0b592eaecc833 --- /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 0000000000000..e4a42e31c1a8a --- /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 0000000000000..7ecab227437fc --- /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 0000000000000..875555253183f --- /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 0000000000000..e7e94ff541f05 --- /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 0000000000000..f76a19ac300c2 --- /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 0000000000000..506bd20c450ae --- /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 0000000000000..fbbec3eff52a1 --- /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 0000000000000..523ba744852df --- /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 0000000000000..2ea172cbd9d8e --- /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 0000000000000..a5a3d08a508a7 --- /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 0000000000000..a7c1b64f9ba14 --- /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 0000000000000..9f0a1e6b0627b --- /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 0000000000000..519df65a81c2a --- /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 0000000000000..e8e71254c3823 --- /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 0000000000000..7f43ce87fd720 --- /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 0000000000000..aab0bf562ff02 --- /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 0000000000000..e36bf8437ad1c --- /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 0000000000000..df88ae9c90b5c --- /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 0000000000000..3c7ee089fbf77 --- /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 0000000000000..6a4e30a4387ab --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/__init__.py @@ -0,0 +1,581 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import 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 +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 LocalUser # type: ignore + from ._models import LocalUserKeys # type: ignore + from ._models import LocalUserRegeneratePasswordResult # type: ignore + from ._models import LocalUsers # 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 PermissionScope # 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 SshPublicKey # 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 ._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.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models.py new file mode 100644 index 0000000000000..8ef620e82b80d --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/models/_models.py @@ -0,0 +1,7640 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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'] + self.sam_account_name = kwargs.get('sam_account_name', None) + self.account_type = kwargs.get('account_type', 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 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, + **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 = 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 + :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, + **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 = 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_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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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_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, + **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 = 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. + + :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, + **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 = 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_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, + **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 = kwargs.get('error', None) + + +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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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_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, + **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 = kwargs['deleted_share_name'] + self.deleted_share_version = kwargs['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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = kwargs.get('encryption_user_assigned_identity', None) + self.encryption_federated_identity_client_id = kwargs.get('encryption_federated_identity_client_id', 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 + :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, + **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 = 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. + + :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, + **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 = 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_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, + **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 = 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. + + :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, + **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 = 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 + :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, + **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 = 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. + + :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, + **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 = kwargs.get('error', None) + + +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, + **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 = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +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, + **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 = 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_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, + **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 = 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 + :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, + **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 = 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 + :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, + **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 = 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_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, + **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 = 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 + :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, + **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 = 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_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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = kwargs['ip_address_or_range'] + self.action = kwargs.get('action', None) + + +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, + **kwargs + ): + """ + :keyword key1: + :paramtype key1: ~datetime.datetime + :keyword key2: + :paramtype key2: ~datetime.datetime + """ + 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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 + :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, + **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 = 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 + :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, + **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 = 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_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, + **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 = 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_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, + **kwargs + ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ + 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_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, + **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 = kwargs.get('permission_scopes', None) + self.home_directory = kwargs.get('home_directory', None) + self.ssh_authorized_keys = kwargs.get('ssh_authorized_keys', None) + self.sid = None + self.has_shared_key = kwargs.get('has_shared_key', None) + self.has_ssh_key = kwargs.get('has_ssh_key', None) + self.has_ssh_password = kwargs.get('has_ssh_password', None) + + +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, + **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 = kwargs.get('ssh_authorized_keys', None) + 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, + **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 = kwargs.get('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 + :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, + **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 = kwargs.get('policy', None) + + +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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = kwargs['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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :ivar enabled: Indicates whether multichannel is enabled. + :vartype enabled: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + :keyword enabled: Indicates whether multichannel is enabled. + :paramtype enabled: bool + """ + 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. + + :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, + **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 = 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. + + :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, + **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 = 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 + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = kwargs.get('value', None) + + +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, + **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 = kwargs['permissions'] + self.service = kwargs['service'] + self.resource_name = kwargs['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, + **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 = 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. + + :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, + **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 = 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] + :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, + **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 = kwargs.get('required_zone_names', None) + + +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, + **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 = kwargs.get('value', None) + + +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, + **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 = 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. + + :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, + **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 = kwargs.get('allow_protected_append_writes_all', None) + 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, + **kwargs + ): + """ + :keyword smb: Setting for SMB protocol. + :paramtype smb: ~azure.mgmt.storage.v2021_08_01.models.SmbSetting + """ + 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 + :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, + **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 = kwargs.get('cors', None) + + +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, + **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 = 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. + + :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, + **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 = 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] + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = kwargs.get('metric_specifications', None) + + +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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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. + + :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, + **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 = 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 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, + **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 = kwargs.get('description', None) + self.key = kwargs.get('key', 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 + :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, + **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 = 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 + :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, + **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__(**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_sftp_enabled = kwargs.get('is_sftp_enabled', None) + self.is_local_user_enabled = kwargs.get('is_local_user_enabled', 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) + self.allowed_copy_scope = kwargs.get('allowed_copy_scope', 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. + + :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, + **kwargs + ): + """ + :keyword name: Required. The storage account name. + :paramtype name: str + """ + 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. + + :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, + **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 = 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.allowed_copy_scope = kwargs.get('allowed_copy_scope', 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_sftp_enabled = kwargs.get('is_sftp_enabled', None) + self.is_local_user_enabled = kwargs.get('is_local_user_enabled', 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_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, + **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 = kwargs['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, + **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 = 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.is_sftp_enabled = kwargs.get('is_sftp_enabled', None) + self.is_local_user_enabled = kwargs.get('is_local_user_enabled', 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) + self.allowed_copy_scope = kwargs.get('allowed_copy_scope', 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 + :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, + **kwargs + ): + """ + :keyword metadata: A name-value pair that represents queue metadata. + :paramtype metadata: dict[str, str] + """ + 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_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, + **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 = 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 + :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, + **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 = 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. + + :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, + **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 = 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_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, + **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 = 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_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, + **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 = 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. + + :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, + **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 = 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_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 0000000000000..cd6e033ecae9f --- /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 0000000000000..343311c702339 --- /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 0000000000000..4c1064ae3825e --- /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 0000000000000..5824f5151c5dd --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_containers_operations.py @@ -0,0 +1,1718 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + include = kwargs.pop('include', None) # type: Optional[Union[str, "_models.ListContainersInclude"]] + + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_clear_legal_hold_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_or_update_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match', 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, + **kwargs + ) + + +def build_get_immutability_policy_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match', 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') + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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] + 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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + if_match = kwargs.pop('if_match') # type: 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/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, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + if_match = kwargs.pop('if_match') # type: 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_object_level_worm_request_initial( + resource_group_name, # type: str + account_name, # type: str + container_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # 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"] + """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, # type: str + account_name, # type: str + container_name, # type: str + blob_container, # type: "_models.BlobContainer" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + blob_container, # type: "_models.BlobContainer" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + container_name, # type: str + legal_hold, # type: "_models.LegalHold" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + legal_hold, # type: "_models.LegalHold" + **kwargs # type: Any + ): + # type: (...) -> "_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, # 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" + """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, # type: str + account_name, # type: str + container_name, # type: str + if_match=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + if_match, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # 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" + """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, # type: str + account_name, # type: str + container_name, # type: str + parameters=None, # type: Optional["_models.LeaseContainerRequest"] + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + container_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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, # type: str + account_name, # type: str + container_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..0236c59167077 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_inventory_policies_operations.py @@ -0,0 +1,478 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any + ): + # type: (...) -> "_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, # 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" + """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, # type: str + account_name, # type: str + blob_inventory_policy_name, # type: Union[str, "_models.BlobInventoryPolicyName"] + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..4fe77a151d13a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_blob_services_operations.py @@ -0,0 +1,368 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + parameters, # type: "_models.BlobServiceProperties" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..9366542b141e3 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_deleted_accounts_operations.py @@ -0,0 +1,242 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + location, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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 # type: Any + ): + # type: (...) -> 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, # type: str + location, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..b39c9dd926a0a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_encryption_scopes_operations.py @@ -0,0 +1,503 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_put_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_patch_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + encryption_scope_name, # type: str + encryption_scope, # type: "_models.EncryptionScope" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + encryption_scope_name, # type: str + encryption_scope, # type: "_models.EncryptionScope" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + encryption_scope_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..2a391bb8e01ef --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_services_operations.py @@ -0,0 +1,348 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.FileServiceProperties" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..dd529a7e1f55a --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_file_shares_operations.py @@ -0,0 +1,907 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', None) # type: Optional[str] + expand = kwargs.pop('expand', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + expand = kwargs.pop('expand', 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + x_ms_snapshot = kwargs.pop('x_ms_snapshot', None) # type: Optional[str] + include = kwargs.pop('include', 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') + 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, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_lease_request( + resource_group_name, # type: str + account_name, # type: str + share_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + content_type = kwargs.pop('content_type', None) # type: Optional[str] + x_ms_snapshot = kwargs.pop('x_ms_snapshot', 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, + **kwargs + ) + +# fmt: on +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, # 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"] + """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, # 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" + """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, # type: str + account_name, # type: str + share_name, # type: str + file_share, # type: "_models.FileShare" + **kwargs # type: Any + ): + # type: (...) -> "_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, # 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" + """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, # 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 + """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, # type: str + account_name, # type: str + share_name, # type: str + deleted_share, # type: "_models.DeletedShare" + **kwargs # type: Any + ): + # type: (...) -> 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, # 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" + """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 0000000000000..689be37c9109f --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_local_users_operations.py @@ -0,0 +1,648 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + username, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + username, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + username, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + username, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + username, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + username, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + username, # type: str + properties, # type: "_models.LocalUser" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + username, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + username, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + username, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..c2d3fec252ad2 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_management_policies_operations.py @@ -0,0 +1,352 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + properties, # type: "_models.ManagementPolicy" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + management_policy_name, # type: Union[str, "_models.ManagementPolicyName"] + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..a52b2d97311ca --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_object_replication_policies_operations.py @@ -0,0 +1,482 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + object_replication_policy_id, # type: str + properties, # type: "_models.ObjectReplicationPolicy" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + object_replication_policy_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..b5bd22692e898 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_operations.py @@ -0,0 +1,143 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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 # type: Any + ): + # type: (...) -> 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 0000000000000..9d31857d5ee0b --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_endpoint_connections_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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + private_endpoint_connection_name, # type: str + properties, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..d937d283164b4 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_private_link_resources_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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_storage_account_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..248cccdebacb9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_operations.py @@ -0,0 +1,611 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_update_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + queue_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + maxpagesize = kwargs.pop('maxpagesize', None) # type: Optional[str] + filter = kwargs.pop('filter', 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') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + queue_name, # type: str + queue, # type: "_models.StorageQueue" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + queue_name, # type: str + queue, # type: "_models.StorageQueue" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + queue_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + maxpagesize=None, # type: Optional[str] + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..9080fd86a62a9 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_queue_services_operations.py @@ -0,0 +1,348 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.QueueServiceProperties" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..820996ba25f80 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_skus_operations.py @@ -0,0 +1,152 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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 # type: Any + ): + # type: (...) -> 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 0000000000000..48ad1a9254f18 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_storage_accounts_operations.py @@ -0,0 +1,1890 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_check_name_availability_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_create_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_delete_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', None) # type: Optional[Union[str, "_models.StorageAccountExpand"]] + + 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_request( + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + expand = kwargs.pop('expand', "kerb") # 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_account_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_list_service_sas_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_failover_request_initial( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> HttpRequest + request_type = kwargs.pop('request_type') # type: 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}/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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_revoke_user_delegation_keys_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: "_models.StorageAccountCheckNameAvailabilityParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.StorageAccountCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + parameters, # type: "_models.StorageAccountCreateParameters" + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + expand=None, # type: Optional[Union[str, "_models.StorageAccountExpand"]] + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.StorageAccountUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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 # type: Any + ): + # type: (...) -> 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, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + expand="kerb", # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + regenerate_key, # type: "_models.StorageAccountRegenerateKeyParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.AccountSasParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.ServiceSasParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + request_type, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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, # type: str + account_name, # type: str + request_type, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + parameters, # type: "_models.BlobRestoreParameters" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.BlobRestoreParameters" + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..74b3fc347206c --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_operations.py @@ -0,0 +1,564 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_create_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + table_name, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + table_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..ecd38476d0b72 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_table_services_operations.py @@ -0,0 +1,348 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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, + **kwargs + ) + + +def build_get_service_properties_request( + resource_group_name, # type: str + account_name, # type: str + subscription_id, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + parameters, # type: "_models.TableServiceProperties" + **kwargs # type: Any + ): + # type: (...) -> "_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, # type: str + account_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_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 0000000000000..61b328adf1b83 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2021_08_01/operations/_usages_operations.py @@ -0,0 +1,158 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import 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 + +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]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False +# fmt: off + +def build_list_by_location_request( + subscription_id, # type: str + location, # type: str + **kwargs # type: Any +): + # type: (...) -> 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 + ) + +# fmt: on +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, # type: str + **kwargs # type: Any + ): + # type: (...) -> 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 0000000000000..e5aff4f83af86 --- /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