From edc2aa9482ceacd8eafd2b05a472aa294e0592a1 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 22 Apr 2025 01:39:10 +0000 Subject: [PATCH] CodeGen from PR 34109 in Azure/azure-rest-api-specs Merge b5ce5d10725d52455fc282ab0a3318157ea3f04e into a55917cb512540bc3d0aec760d4e28712c3a4ae0 --- .../azure-mgmt-resource/CHANGELOG.md | 16 + sdk/resources/azure-mgmt-resource/README.md | 6 +- sdk/resources/azure-mgmt-resource/_meta.json | 6 +- .../azure/mgmt/resource/__init__.py | 32 +- .../azure/mgmt/resource/_version.py | 2 +- .../mgmt/resource/changes/_changes_client.py | 17 +- .../mgmt/resource/changes/_serialization.py | 176 +- .../azure/mgmt/resource/changes/_version.py | 2 +- .../resource/changes/aio/_changes_client.py | 17 +- .../changes/v2022_05_01/_changes_client.py | 24 +- .../changes/v2022_05_01/_metadata.json | 10 +- .../resource/changes/v2022_05_01/_version.py | 2 +- .../v2022_05_01/aio/_changes_client.py | 26 +- .../v2022_05_01/aio/operations/_operations.py | 17 +- .../changes/v2022_05_01/models/_models_py3.py | 49 +- .../v2022_05_01/operations/_operations.py | 23 +- .../_data_boundary_mgmt_client.py | 17 +- .../resource/databoundaries/_serialization.py | 176 +- .../mgmt/resource/databoundaries/_version.py | 2 +- .../aio/_data_boundary_mgmt_client.py | 17 +- .../v2024_08_01/_data_boundary_mgmt_client.py | 22 +- .../databoundaries/v2024_08_01/_metadata.json | 10 +- .../databoundaries/v2024_08_01/_version.py | 2 +- .../aio/_data_boundary_mgmt_client.py | 24 +- .../v2024_08_01/aio/operations/_operations.py | 17 +- .../v2024_08_01/models/_models_py3.py | 31 +- .../v2024_08_01/operations/_operations.py | 18 +- .../_deployment_scripts_client.py | 17 +- .../deploymentscripts/_serialization.py | 176 +- .../resource/deploymentscripts/_version.py | 2 +- .../aio/_deployment_scripts_client.py | 17 +- .../_deployment_scripts_client.py | 22 +- .../v2019_10_01_preview/_metadata.json | 10 +- .../v2019_10_01_preview/_version.py | 2 +- .../aio/_deployment_scripts_client.py | 24 +- .../aio/operations/_operations.py | 23 +- .../v2019_10_01_preview/models/_models_py3.py | 72 +- .../operations/_operations.py | 39 +- .../v2020_10_01/_deployment_scripts_client.py | 22 +- .../v2020_10_01/_metadata.json | 10 +- .../deploymentscripts/v2020_10_01/_version.py | 2 +- .../aio/_deployment_scripts_client.py | 24 +- .../v2020_10_01/aio/operations/_operations.py | 20 +- .../v2020_10_01/models/_models_py3.py | 72 +- .../v2020_10_01/operations/_operations.py | 34 +- .../v2023_08_01/_deployment_scripts_client.py | 22 +- .../v2023_08_01/_metadata.json | 10 +- .../deploymentscripts/v2023_08_01/_version.py | 2 +- .../aio/_deployment_scripts_client.py | 24 +- .../v2023_08_01/aio/operations/_operations.py | 20 +- .../v2023_08_01/models/_models_py3.py | 72 +- .../v2023_08_01/operations/_operations.py | 34 +- .../_deployment_stacks_client.py | 17 +- .../deploymentstacks/_serialization.py | 176 +- .../resource/deploymentstacks/_version.py | 2 +- .../aio/_deployment_stacks_client.py | 17 +- .../_deployment_stacks_client.py | 22 +- .../v2022_08_01_preview/_metadata.json | 10 +- .../v2022_08_01_preview/_version.py | 2 +- .../aio/_deployment_stacks_client.py | 24 +- .../aio/operations/_operations.py | 31 +- .../v2022_08_01_preview/models/_models_py3.py | 69 +- .../operations/_operations.py | 48 +- .../v2024_03_01/_deployment_stacks_client.py | 22 +- .../v2024_03_01/_metadata.json | 10 +- .../deploymentstacks/v2024_03_01/_version.py | 2 +- .../aio/_deployment_stacks_client.py | 24 +- .../v2024_03_01/aio/operations/_operations.py | 31 +- .../v2024_03_01/models/_models_py3.py | 81 +- .../v2024_03_01/operations/_operations.py | 63 +- .../mgmt/resource/features/_feature_client.py | 17 +- .../mgmt/resource/features/_serialization.py | 176 +- .../azure/mgmt/resource/features/_version.py | 2 +- .../resource/features/aio/_feature_client.py | 17 +- .../features/v2015_12_01/_feature_client.py | 24 +- .../features/v2015_12_01/_metadata.json | 14 +- .../resource/features/v2015_12_01/_version.py | 2 +- .../v2015_12_01/aio/_feature_client.py | 26 +- .../v2015_12_01/aio/operations/_operations.py | 18 +- .../v2015_12_01/operations/_operations.py | 27 +- .../features/v2021_07_01/_feature_client.py | 24 +- .../features/v2021_07_01/_metadata.json | 14 +- .../resource/features/v2021_07_01/_version.py | 2 +- .../v2021_07_01/aio/_feature_client.py | 26 +- .../v2021_07_01/aio/operations/_operations.py | 28 +- .../v2021_07_01/models/_models_py3.py | 38 +- .../v2021_07_01/operations/_operations.py | 46 +- .../resource/links/_management_link_client.py | 17 +- .../mgmt/resource/links/_serialization.py | 176 +- .../azure/mgmt/resource/links/_version.py | 2 +- .../links/aio/_management_link_client.py | 17 +- .../v2016_09_01/_management_link_client.py | 22 +- .../resource/links/v2016_09_01/_metadata.json | 10 +- .../resource/links/v2016_09_01/_version.py | 2 +- .../aio/_management_link_client.py | 24 +- .../v2016_09_01/aio/operations/_operations.py | 31 +- .../links/v2016_09_01/models/_models_py3.py | 10 +- .../v2016_09_01/operations/_operations.py | 32 +- .../resource/locks/_management_lock_client.py | 17 +- .../mgmt/resource/locks/_serialization.py | 176 +- .../azure/mgmt/resource/locks/_version.py | 2 +- .../locks/aio/_management_lock_client.py | 17 +- .../v2015_01_01/_management_lock_client.py | 22 +- .../resource/locks/v2015_01_01/_metadata.json | 10 +- .../resource/locks/v2015_01_01/_version.py | 2 +- .../aio/_management_lock_client.py | 24 +- .../v2015_01_01/aio/operations/_operations.py | 17 +- .../locks/v2015_01_01/models/_models_py3.py | 4 +- .../v2015_01_01/operations/_operations.py | 34 +- .../v2016_09_01/_management_lock_client.py | 22 +- .../resource/locks/v2016_09_01/_metadata.json | 10 +- .../resource/locks/v2016_09_01/_version.py | 2 +- .../aio/_management_lock_client.py | 24 +- .../v2016_09_01/aio/operations/_operations.py | 31 +- .../locks/v2016_09_01/models/_models_py3.py | 6 +- .../v2016_09_01/operations/_operations.py | 48 +- .../_application_client.py | 17 +- .../managedapplications/_serialization.py | 176 +- .../resource/managedapplications/_version.py | 2 +- .../aio/_application_client.py | 17 +- .../v2019_07_01/_application_client.py | 24 +- .../v2019_07_01/_metadata.json | 14 +- .../v2019_07_01/_version.py | 2 +- .../v2019_07_01/aio/_application_client.py | 26 +- .../v2019_07_01/aio/operations/_operations.py | 47 +- .../v2019_07_01/models/_models_py3.py | 123 +- .../v2019_07_01/operations/_operations.py | 78 +- .../mgmt/resource/policy/_policy_client.py | 17 +- .../mgmt/resource/policy/_serialization.py | 176 +- .../azure/mgmt/resource/policy/_version.py | 2 +- .../resource/policy/aio/_policy_client.py | 17 +- .../policy/v2015_10_01_preview/_metadata.json | 10 +- .../v2015_10_01_preview/_policy_client.py | 24 +- .../policy/v2015_10_01_preview/_version.py | 2 +- .../v2015_10_01_preview/aio/_policy_client.py | 26 +- .../aio/operations/_operations.py | 31 +- .../v2015_10_01_preview/models/_models_py3.py | 11 +- .../operations/_operations.py | 38 +- .../policy/v2016_04_01/_metadata.json | 10 +- .../policy/v2016_04_01/_policy_client.py | 24 +- .../resource/policy/v2016_04_01/_version.py | 2 +- .../policy/v2016_04_01/aio/_policy_client.py | 26 +- .../v2016_04_01/aio/operations/_operations.py | 27 +- .../policy/v2016_04_01/models/_models_py3.py | 11 +- .../v2016_04_01/operations/_operations.py | 38 +- .../policy/v2016_12_01/_metadata.json | 10 +- .../policy/v2016_12_01/_policy_client.py | 24 +- .../resource/policy/v2016_12_01/_version.py | 2 +- .../policy/v2016_12_01/aio/_policy_client.py | 26 +- .../v2016_12_01/aio/operations/_operations.py | 27 +- .../policy/v2016_12_01/models/_models_py3.py | 15 +- .../v2016_12_01/operations/_operations.py | 46 +- .../policy/v2017_06_01_preview/_metadata.json | 10 +- .../v2017_06_01_preview/_policy_client.py | 24 +- .../policy/v2017_06_01_preview/_version.py | 2 +- .../v2017_06_01_preview/aio/_policy_client.py | 26 +- .../aio/operations/_operations.py | 33 +- .../v2017_06_01_preview/models/_models_py3.py | 21 +- .../operations/_operations.py | 48 +- .../policy/v2018_03_01/_metadata.json | 10 +- .../policy/v2018_03_01/_policy_client.py | 24 +- .../resource/policy/v2018_03_01/_version.py | 2 +- .../policy/v2018_03_01/aio/_policy_client.py | 26 +- .../v2018_03_01/aio/operations/_operations.py | 40 +- .../policy/v2018_03_01/models/_models_py3.py | 27 +- .../v2018_03_01/operations/_operations.py | 75 +- .../policy/v2018_05_01/_metadata.json | 10 +- .../policy/v2018_05_01/_policy_client.py | 24 +- .../resource/policy/v2018_05_01/_version.py | 2 +- .../policy/v2018_05_01/aio/_policy_client.py | 26 +- .../v2018_05_01/aio/operations/_operations.py | 40 +- .../policy/v2018_05_01/models/_models_py3.py | 31 +- .../v2018_05_01/operations/_operations.py | 75 +- .../policy/v2019_01_01/_metadata.json | 10 +- .../policy/v2019_01_01/_policy_client.py | 24 +- .../resource/policy/v2019_01_01/_version.py | 2 +- .../policy/v2019_01_01/aio/_policy_client.py | 26 +- .../v2019_01_01/aio/operations/_operations.py | 40 +- .../policy/v2019_01_01/models/_models_py3.py | 31 +- .../v2019_01_01/operations/_operations.py | 75 +- .../policy/v2019_06_01/_metadata.json | 10 +- .../policy/v2019_06_01/_policy_client.py | 24 +- .../resource/policy/v2019_06_01/_version.py | 2 +- .../policy/v2019_06_01/aio/_policy_client.py | 26 +- .../v2019_06_01/aio/operations/_operations.py | 40 +- .../policy/v2019_06_01/models/_models_py3.py | 31 +- .../v2019_06_01/operations/_operations.py | 75 +- .../policy/v2019_09_01/_metadata.json | 10 +- .../policy/v2019_09_01/_policy_client.py | 24 +- .../resource/policy/v2019_09_01/_version.py | 2 +- .../policy/v2019_09_01/aio/_policy_client.py | 26 +- .../v2019_09_01/aio/operations/_operations.py | 40 +- .../policy/v2019_09_01/models/_models_py3.py | 45 +- .../v2019_09_01/operations/_operations.py | 77 +- .../policy/v2020_07_01_preview/_metadata.json | 10 +- .../v2020_07_01_preview/_policy_client.py | 24 +- .../policy/v2020_07_01_preview/_version.py | 2 +- .../v2020_07_01_preview/aio/_policy_client.py | 26 +- .../aio/operations/_operations.py | 23 +- .../v2020_07_01_preview/models/_models_py3.py | 33 +- .../operations/_operations.py | 31 +- .../policy/v2020_09_01/_metadata.json | 10 +- .../policy/v2020_09_01/_policy_client.py | 24 +- .../resource/policy/v2020_09_01/_version.py | 2 +- .../policy/v2020_09_01/aio/_policy_client.py | 26 +- .../v2020_09_01/aio/operations/_operations.py | 48 +- .../policy/v2020_09_01/models/_models_py3.py | 61 +- .../v2020_09_01/operations/_operations.py | 85 +- .../policy/v2021_06_01/_metadata.json | 10 +- .../policy/v2021_06_01/_policy_client.py | 24 +- .../resource/policy/v2021_06_01/_version.py | 2 +- .../policy/v2021_06_01/aio/_policy_client.py | 26 +- .../v2021_06_01/aio/operations/_operations.py | 43 +- .../policy/v2021_06_01/models/_models_py3.py | 63 +- .../v2021_06_01/operations/_operations.py | 80 +- .../policy/v2022_06_01/_metadata.json | 10 +- .../policy/v2022_06_01/_policy_client.py | 24 +- .../resource/policy/v2022_06_01/_version.py | 2 +- .../policy/v2022_06_01/aio/_policy_client.py | 26 +- .../v2022_06_01/aio/operations/_operations.py | 27 +- .../policy/v2022_06_01/models/_models_py3.py | 46 +- .../v2022_06_01/operations/_operations.py | 34 +- .../policy/v2022_07_01_preview/_metadata.json | 10 +- .../v2022_07_01_preview/_policy_client.py | 24 +- .../policy/v2022_07_01_preview/_version.py | 2 +- .../v2022_07_01_preview/aio/_policy_client.py | 26 +- .../aio/operations/_operations.py | 26 +- .../v2022_07_01_preview/models/_models_py3.py | 33 +- .../operations/_operations.py | 34 +- .../policy/v2022_08_01_preview/_metadata.json | 10 +- .../v2022_08_01_preview/_policy_client.py | 24 +- .../policy/v2022_08_01_preview/_version.py | 2 +- .../v2022_08_01_preview/aio/_policy_client.py | 26 +- .../aio/operations/_operations.py | 25 +- .../v2022_08_01_preview/models/_models_py3.py | 43 +- .../operations/_operations.py | 58 +- .../policy/v2023_04_01/_metadata.json | 10 +- .../policy/v2023_04_01/_policy_client.py | 24 +- .../resource/policy/v2023_04_01/_version.py | 2 +- .../policy/v2023_04_01/aio/_policy_client.py | 26 +- .../v2023_04_01/aio/operations/_operations.py | 62 +- .../policy/v2023_04_01/models/_models_py3.py | 87 +- .../v2023_04_01/operations/_operations.py | 142 +- .../_resource_private_link_client.py | 17 +- .../resource/privatelinks/_serialization.py | 176 +- .../mgmt/resource/privatelinks/_version.py | 2 +- .../aio/_resource_private_link_client.py | 17 +- .../privatelinks/v2020_05_01/_metadata.json | 10 +- .../_resource_private_link_client.py | 22 +- .../privatelinks/v2020_05_01/_version.py | 2 +- .../aio/_resource_private_link_client.py | 24 +- .../v2020_05_01/aio/operations/_operations.py | 25 +- .../v2020_05_01/models/_models_py3.py | 26 +- .../v2020_05_01/operations/_operations.py | 45 +- .../resources/_resource_management_client.py | 47 +- .../mgmt/resource/resources/_serialization.py | 176 +- .../azure/mgmt/resource/resources/_version.py | 2 +- .../aio/_resource_management_client.py | 47 +- .../azure/mgmt/resource/resources/models.py | 2 +- .../resources/v2016_02_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2016_02_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2016_02_01/aio/operations/_operations.py | 63 +- .../v2016_02_01/models/_models_py3.py | 51 +- .../v2016_02_01/operations/_operations.py | 94 +- .../resources/v2016_09_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2016_09_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2016_09_01/aio/operations/_operations.py | 72 +- .../v2016_09_01/models/_models_py3.py | 103 +- .../v2016_09_01/operations/_operations.py | 103 +- .../resources/v2017_05_10/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2017_05_10/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2017_05_10/aio/operations/_operations.py | 72 +- .../v2017_05_10/models/_models_py3.py | 103 +- .../v2017_05_10/operations/_operations.py | 105 +- .../resources/v2018_02_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2018_02_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2018_02_01/aio/operations/_operations.py | 72 +- .../v2018_02_01/models/_models_py3.py | 105 +- .../v2018_02_01/operations/_operations.py | 105 +- .../resources/v2018_05_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2018_05_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2018_05_01/aio/operations/_operations.py | 80 +- .../v2018_05_01/models/_models_py3.py | 127 +- .../v2018_05_01/operations/_operations.py | 131 +- .../resources/v2019_03_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_03_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_03_01/aio/operations/_operations.py | 80 +- .../v2019_03_01/models/_models_py3.py | 129 +- .../v2019_03_01/operations/_operations.py | 131 +- .../resources/v2019_05_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_05_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_05_01/aio/operations/_operations.py | 80 +- .../v2019_05_01/models/_models_py3.py | 133 +- .../v2019_05_01/operations/_operations.py | 151 +- .../resources/v2019_05_10/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_05_10/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_05_10/aio/operations/_operations.py | 80 +- .../v2019_05_10/models/_models_py3.py | 133 +- .../v2019_05_10/operations/_operations.py | 151 +- .../resources/v2019_07_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_07_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_07_01/aio/operations/_operations.py | 80 +- .../v2019_07_01/models/_models_py3.py | 125 +- .../v2019_07_01/operations/_operations.py | 157 +- .../resources/v2019_08_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_08_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_08_01/aio/operations/_operations.py | 80 +- .../v2019_08_01/models/_models_py3.py | 125 +- .../v2019_08_01/operations/_operations.py | 157 +- .../resources/v2019_10_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2019_10_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2019_10_01/aio/operations/_operations.py | 80 +- .../v2019_10_01/models/_models_py3.py | 157 +- .../v2019_10_01/operations/_operations.py | 159 +- .../resources/v2020_06_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2020_06_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2020_06_01/aio/operations/_operations.py | 80 +- .../v2020_06_01/models/_models_py3.py | 173 +- .../v2020_06_01/operations/_operations.py | 161 +- .../resources/v2020_10_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2020_10_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2020_10_01/aio/operations/_operations.py | 88 +- .../v2020_10_01/models/_models_py3.py | 175 +- .../v2020_10_01/operations/_operations.py | 169 +- .../resources/v2021_01_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2021_01_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2021_01_01/aio/operations/_operations.py | 88 +- .../v2021_01_01/models/_models_py3.py | 175 +- .../v2021_01_01/operations/_operations.py | 169 +- .../resources/v2021_04_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2021_04_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2021_04_01/aio/operations/_operations.py | 88 +- .../v2021_04_01/models/_models_py3.py | 177 +- .../v2021_04_01/operations/_operations.py | 171 +- .../resources/v2022_09_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2022_09_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2022_09_01/aio/operations/_operations.py | 88 +- .../v2022_09_01/models/_models_py3.py | 177 +- .../v2022_09_01/operations/_operations.py | 171 +- .../resources/v2024_07_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2024_07_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2024_07_01/aio/operations/_operations.py | 88 +- .../v2024_07_01/models/_models_py3.py | 197 +- .../v2024_07_01/operations/_operations.py | 171 +- .../resources/v2024_11_01/_metadata.json | 10 +- .../_resource_management_client.py | 22 +- .../resources/v2024_11_01/_version.py | 2 +- .../aio/_resource_management_client.py | 24 +- .../v2024_11_01/aio/operations/_operations.py | 88 +- .../v2024_11_01/models/_models_py3.py | 204 +- .../v2024_11_01/operations/_operations.py | 171 +- .../resources/v2025_03_01/__init__.py | 32 + .../resources/v2025_03_01/_configuration.py | 64 + .../resources/v2025_03_01/_metadata.json | 117 + .../resource/resources/v2025_03_01/_patch.py | 21 + .../_resource_management_client.py | 161 + .../resources/v2025_03_01/_version.py | 9 + .../resources/v2025_03_01/aio/__init__.py | 29 + .../v2025_03_01/aio/_configuration.py | 64 + .../resources/v2025_03_01/aio/_patch.py | 21 + .../aio/_resource_management_client.py | 167 + .../v2025_03_01/aio/operations/__init__.py | 39 + .../v2025_03_01/aio/operations/_operations.py | 9860 ++++++++++++ .../v2025_03_01/aio/operations/_patch.py | 21 + .../resources/v2025_03_01/models/__init__.py | 242 + .../v2025_03_01/models/_models_py3.py | 4017 +++++ .../resources/v2025_03_01/models/_patch.py | 21 + .../_resource_management_client_enums.py | 271 + .../v2025_03_01/operations/__init__.py | 39 + .../v2025_03_01/operations/_operations.py | 12763 ++++++++++++++++ .../v2025_03_01/operations/_patch.py | 21 + .../resource/resources/v2025_03_01/py.typed | 1 + .../resource/subscriptions/_serialization.py | 176 +- .../subscriptions/_subscription_client.py | 17 +- .../mgmt/resource/subscriptions/_version.py | 2 +- .../subscriptions/aio/_subscription_client.py | 17 +- .../subscriptions/v2016_06_01/_metadata.json | 10 +- .../v2016_06_01/_subscription_client.py | 22 +- .../subscriptions/v2016_06_01/_version.py | 2 +- .../v2016_06_01/aio/_subscription_client.py | 24 +- .../v2016_06_01/aio/operations/_operations.py | 35 +- .../v2016_06_01/models/_models_py3.py | 52 +- .../v2016_06_01/operations/_operations.py | 34 +- .../subscriptions/v2018_06_01/_metadata.json | 10 +- .../v2018_06_01/_subscription_client.py | 22 +- .../subscriptions/v2018_06_01/_version.py | 2 +- .../v2018_06_01/aio/_subscription_client.py | 24 +- .../v2018_06_01/aio/operations/_operations.py | 35 +- .../v2018_06_01/models/_models_py3.py | 62 +- .../v2018_06_01/operations/_operations.py | 34 +- .../subscriptions/v2019_06_01/_metadata.json | 10 +- .../v2019_06_01/_subscription_client.py | 22 +- .../subscriptions/v2019_06_01/_version.py | 2 +- .../v2019_06_01/aio/_subscription_client.py | 24 +- .../v2019_06_01/aio/operations/_operations.py | 35 +- .../v2019_06_01/models/_models_py3.py | 66 +- .../v2019_06_01/operations/_operations.py | 34 +- .../subscriptions/v2019_11_01/_metadata.json | 10 +- .../v2019_11_01/_subscription_client.py | 22 +- .../subscriptions/v2019_11_01/_version.py | 2 +- .../v2019_11_01/aio/_subscription_client.py | 24 +- .../v2019_11_01/aio/operations/_operations.py | 35 +- .../v2019_11_01/models/_models_py3.py | 82 +- .../v2019_11_01/operations/_operations.py | 34 +- .../subscriptions/v2021_01_01/_metadata.json | 10 +- .../v2021_01_01/_subscription_client.py | 22 +- .../subscriptions/v2021_01_01/_version.py | 2 +- .../v2021_01_01/aio/_subscription_client.py | 24 +- .../v2021_01_01/aio/operations/_operations.py | 27 +- .../v2021_01_01/models/_models_py3.py | 102 +- .../v2021_01_01/operations/_operations.py | 26 +- .../subscriptions/v2022_12_01/_metadata.json | 10 +- .../v2022_12_01/_subscription_client.py | 22 +- .../subscriptions/v2022_12_01/_version.py | 2 +- .../v2022_12_01/aio/_subscription_client.py | 24 +- .../v2022_12_01/aio/operations/_operations.py | 35 +- .../v2022_12_01/models/_models_py3.py | 134 +- .../v2022_12_01/operations/_operations.py | 34 +- .../mgmt/resource/templatespecs/_version.py | 2 +- .../v2019_06_01_preview/_version.py | 2 +- .../v2021_03_01_preview/_version.py | 2 +- .../templatespecs/v2021_05_01/_version.py | 2 +- .../templatespecs/v2022_02_01/_version.py | 2 +- .../generated_samples/changes/get_change.py | 3 +- .../generated_samples/changes/list_changes.py | 3 +- .../get_scoped_data_boundary.py | 3 +- .../get_tenant_data_boundary.py | 3 +- .../databoundaries/put_data_boundary.py | 3 +- .../deployment_scripts_create.py | 3 +- ...scripts_create_no_user_managed_identity.py | 3 +- ...nt_scripts_create_using_custom_aci_name.py | 3 +- ...e_using_custom_aci_name_with_subnet_ids.py | 3 +- ...s_create_using_existing_storage_account.py | 3 +- .../deployment_scripts_delete.py | 3 +- .../deployment_scripts_get.py | 3 +- .../deployment_scripts_get_logs.py | 3 +- .../deployment_scripts_get_logs_default.py | 3 +- ...ment_scripts_get_logs_default_with_tail.py | 3 +- ...ployment_scripts_list_by_resource_group.py | 3 +- ...deployment_scripts_list_by_subscription.py | 3 +- .../deployment_scripts_min_create.py | 3 +- .../deployment_scripts_update.py | 3 +- .../deployment_stack_export_template.py | 3 +- ...eployment_stack_management_group_create.py | 3 +- ...eployment_stack_management_group_delete.py | 3 +- ..._stack_management_group_export_template.py | 3 +- .../deployment_stack_management_group_get.py | 3 +- .../deployment_stack_management_group_list.py | 3 +- ...loyment_stack_management_group_validate.py | 3 +- .../deployment_stack_resource_group_create.py | 3 +- .../deployment_stack_resource_group_delete.py | 3 +- .../deployment_stack_resource_group_get.py | 3 +- .../deployment_stack_resource_group_list.py | 3 +- ...eployment_stack_resource_group_validate.py | 3 +- .../deployment_stack_subscription_create.py | 3 +- .../deployment_stack_subscription_delete.py | 3 +- ...ment_stack_subscription_export_template.py | 3 +- .../deployment_stack_subscription_get.py | 3 +- .../deployment_stack_subscription_list.py | 3 +- .../deployment_stack_subscription_validate.py | 3 +- ...ubscription_feature_registration_delete.py | 3 +- .../subscription_feature_registration_get.py | 3 +- .../subscription_feature_registration_list.py | 3 +- ...bscription_feature_registration_listall.py | 3 +- .../subscription_feature_registration_put.py | 3 +- .../generated_samples/features/get_feature.py | 3 +- .../features/list_features_operations.py | 3 +- .../features/list_provider_features.py | 3 +- .../features/list_subscription_features.py | 3 +- .../features/register_feature.py | 3 +- .../features/unregister_feature.py | 3 +- .../locks/list_provider_operations.py | 3 +- ...reate_or_update_at_resource_group_level.py | 3 +- ...ocks_create_or_update_at_resource_level.py | 3 +- ...agement_locks_create_or_update_at_scope.py | 3 +- ..._create_or_update_at_subscription_level.py | 3 +- ...nt_locks_delete_at_resource_group_level.py | 3 +- ...nagement_locks_delete_at_resource_level.py | 3 +- .../locks/management_locks_delete_at_scope.py | 3 +- ...ment_locks_delete_at_subscription_level.py | 3 +- ...ement_locks_get_at_resource_group_level.py | 3 +- .../management_locks_get_at_resource_level.py | 3 +- .../locks/management_locks_get_at_scope.py | 3 +- ...agement_locks_get_at_subscription_level.py | 3 +- ...ment_locks_list_at_resource_group_level.py | 3 +- ...management_locks_list_at_resource_level.py | 3 +- .../locks/management_locks_list_at_scope.py | 3 +- ...gement_locks_list_at_subscription_level.py | 3 +- .../create_or_update_application.py | 3 +- ...create_or_update_application_definition.py | 5 +- .../delete_application_definition.py | 3 +- .../managedapplications/get_application.py | 3 +- .../get_application_definition.py | 5 +- ...plication_definitions_by_resource_group.py | 3 +- .../list_applications_by_resource_group.py | 3 +- .../list_solutions_operations.py | 3 +- .../managedapplications/update_application.py | 3 +- .../create_or_update_policy_definition.py | 3 +- ...pdate_policy_definition_advanced_params.py | 3 +- ...e_policy_definition_at_management_group.py | 3 +- ...ate_or_update_policy_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- .../create_or_update_policy_set_definition.py | 3 +- ...licy_set_definition_at_management_group.py | 3 +- ...or_update_policy_set_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- ...pdate_policy_set_definition_with_groups.py | 3 +- ...inition_with_groups_at_management_group.py | 3 +- .../policy/create_policy_assignment.py | 3 +- .../policy/create_policy_assignment_by_id.py | 3 +- ...licy_assignment_non_compliance_messages.py | 3 +- .../create_policy_assignment_with_identity.py | 3 +- ...e_policy_assignment_with_identity_by_id.py | 3 +- ...create_policy_assignment_with_overrides.py | 3 +- ...licy_assignment_with_resource_selectors.py | 3 +- ..._assignment_with_user_assigned_identity.py | 3 +- ...e_policy_assignment_without_enforcement.py | 3 +- .../policy/delete_policy_assignment.py | 3 +- .../policy/delete_policy_assignment_by_id.py | 3 +- .../policy/delete_policy_definition.py | 3 +- ...e_policy_definition_at_management_group.py | 3 +- .../delete_policy_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- .../policy/delete_policy_set_definition.py | 3 +- ...licy_set_definition_at_management_group.py | 3 +- .../delete_policy_set_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- .../get_built_in_policy_set_definition.py | 3 +- ..._built_in_policy_set_definition_version.py | 3 +- .../policy/get_builtin_policy_definition.py | 3 +- .../get_builtin_policy_definition_version.py | 3 +- .../policy/get_policy_assignment.py | 3 +- .../policy/get_policy_assignment_by_id.py | 3 +- .../get_policy_assignment_with_identity.py | 3 +- ...t_policy_assignment_with_identity_by_id.py | 3 +- .../get_policy_assignment_with_overrides.py | 3 +- ...licy_assignment_with_resource_selectors.py | 3 +- ..._assignment_with_user_assigned_identity.py | 3 +- .../policy/get_policy_definition.py | 3 +- ...t_policy_definition_at_management_group.py | 3 +- .../policy/get_policy_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- .../policy/get_policy_set_definition.py | 3 +- ...licy_set_definition_at_management_group.py | 3 +- .../get_policy_set_definition_version.py | 3 +- ..._definition_version_at_management_group.py | 3 +- ...all_built_in_policy_definition_versions.py | 3 +- ...built_in_policy_set_definition_versions.py | 3 +- .../list_all_policy_definition_versions.py | 3 +- ...definition_versions_by_management_group.py | 3 +- ...list_all_policy_set_definition_versions.py | 3 +- ...definition_versions_by_management_group.py | 3 +- ...ist_built_in_policy_definition_versions.py | 3 +- .../list_built_in_policy_definitions.py | 3 +- ...built_in_policy_set_definition_versions.py | 3 +- .../list_built_in_policy_set_definitions.py | 3 +- .../policy/list_policy_assignments.py | 3 +- ...policy_assignments_for_management_group.py | 3 +- .../list_policy_assignments_for_resource.py | 3 +- ...t_policy_assignments_for_resource_group.py | 3 +- .../policy/list_policy_definition_versions.py | 3 +- ...definition_versions_by_management_group.py | 3 +- .../policy/list_policy_definitions.py | 3 +- ..._policy_definitions_by_management_group.py | 3 +- .../list_policy_set_definition_versions.py | 3 +- ...definition_versions_by_management_group.py | 3 +- .../policy/list_policy_set_definitions.py | 3 +- ...icy_set_definitions_by_management_group.py | 3 +- .../update_policy_assignment_with_identity.py | 3 +- ...e_policy_assignment_with_identity_by_id.py | 3 +- ...update_policy_assignment_with_overrides.py | 3 +- ...licy_assignment_with_resource_selectors.py | 3 +- ..._assignment_with_user_assigned_identity.py | 3 +- .../delete_private_link_association.py | 3 +- ...delete_resource_management_private_link.py | 3 +- .../get_private_link_association.py | 3 +- .../get_resource_management_private_link.py | 3 +- .../list_private_link_association.py | 3 +- ..._group_resource_management_private_link.py | 3 +- ...iption_resource_management_private_link.py | 3 +- .../put_private_link_association.py | 3 +- .../put_resource_management_private_link.py | 3 +- .../resources/calculate_template_hash.py | 3 +- .../resources/create_resource_group.py | 3 +- .../resources/delete_tags_resource.py | 3 +- .../resources/delete_tags_subscription.py | 3 +- .../resources/export_resource_group.py | 3 +- .../export_resource_group_as_bicep.py | 3 +- .../export_resource_group_with_filtering.py | 3 +- ...e_delete_vms_and_vmss_in_resource_group.py | 3 +- .../force_delete_vms_in_resource_group.py | 3 +- .../resources/get_named_provider_at_tenant.py | 3 +- .../resources/get_provider.py | 3 +- .../resources/get_provider_permissions.py | 3 +- .../resources/get_provider_resource_types.py | 3 +- .../resources/get_providers.py | 3 +- .../resources/get_tags_resource.py | 3 +- .../resources/get_tags_subscription.py | 3 +- .../resources/patch_tags_resource.py | 3 +- .../resources/patch_tags_subscription.py | 3 +- ...deployment_validate_on_management_group.py | 3 +- ...t_deployment_validate_on_resource_group.py | 3 +- .../post_deployment_validate_on_scope.py | 3 +- ...ost_deployment_validate_on_subscription.py | 3 +- .../post_deployment_validate_on_tenant.py | 3 +- ..._deployment_what_if_on_management_group.py | 3 +- ...st_deployment_what_if_on_resource_group.py | 3 +- ...post_deployment_what_if_on_subscription.py | 3 +- .../post_deployment_what_if_on_tenant.py | 3 +- .../put_deployment_at_management_group.py | 3 +- .../resources/put_deployment_at_scope.py | 3 +- .../resources/put_deployment_at_tenant.py | 3 +- .../put_deployment_resource_group.py | 3 +- ...t_resource_group_template_specs_with_id.py | 3 +- ...ent_subscription_template_specs_with_id.py | 3 +- ...ith_on_error_deployment_last_successful.py | 3 +- ...on_error_deployment_specific_deployment.py | 3 +- .../resources/put_tags_resource.py | 3 +- .../resources/put_tags_subscription.py | 3 +- .../subscriptions/check_resource_name.py | 3 +- .../subscriptions/get_locations.py | 3 +- .../get_locations_with_extended_locations.py | 3 +- .../subscriptions/get_subscription.py | 3 +- .../subscriptions/get_subscriptions.py | 3 +- .../subscriptions/get_tenants.py | 3 +- .../subscriptions/post_check_zone_peers.py | 3 +- .../generated_tests/test_application.py | 2 +- ...tion_application_definitions_operations.py | 2 +- ...pplication_definitions_operations_async.py | 2 +- ...est_application_applications_operations.py | 2 +- ...plication_applications_operations_async.py | 2 +- .../generated_tests/test_application_async.py | 2 +- ...est_application_jit_requests_operations.py | 2 +- ...plication_jit_requests_operations_async.py | 2 +- .../test_changes_changes_operations.py | 2 +- .../test_changes_changes_operations_async.py | 2 +- ...oundary_mgmt_data_boundaries_operations.py | 2 +- ...y_mgmt_data_boundaries_operations_async.py | 2 +- ...t_scripts_deployment_scripts_operations.py | 2 +- ...pts_deployment_scripts_operations_async.py | 2 +- ...ent_stacks_deployment_stacks_operations.py | 2 +- ...acks_deployment_stacks_operations_async.py | 2 +- .../generated_tests/test_feature.py | 2 +- .../generated_tests/test_feature_async.py | 2 +- .../test_feature_features_operations.py | 2 +- .../test_feature_features_operations_async.py | 2 +- ...iption_feature_registrations_operations.py | 2 +- ..._feature_registrations_operations_async.py | 2 +- .../test_management_link_operations.py | 2 +- .../test_management_link_operations_async.py | 2 +- ...nagement_link_resource_links_operations.py | 2 +- ...nt_link_resource_links_operations_async.py | 2 +- ...ock_authorization_operations_operations.py | 2 +- ...thorization_operations_operations_async.py | 2 +- ...gement_lock_management_locks_operations.py | 2 +- ..._lock_management_locks_operations_async.py | 2 +- ...st_policy_policy_assignments_operations.py | 2 +- ...icy_policy_assignments_operations_async.py | 2 +- ...y_policy_definition_versions_operations.py | 2 +- ...cy_definition_versions_operations_async.py | 2 +- ...st_policy_policy_definitions_operations.py | 2 +- ...icy_policy_definitions_operations_async.py | 2 +- ...licy_set_definition_versions_operations.py | 2 +- ...et_definition_versions_operations_async.py | 2 +- ...olicy_policy_set_definitions_operations.py | 2 +- ...policy_set_definitions_operations_async.py | 2 +- ...gement_deployment_operations_operations.py | 2 +- ..._deployment_operations_operations_async.py | 2 +- ...ource_management_deployments_operations.py | 2 +- ...management_deployments_operations_async.py | 2 +- .../test_resource_management_operations.py | 2 +- ...st_resource_management_operations_async.py | 2 +- ...ment_provider_resource_types_operations.py | 2 +- ...rovider_resource_types_operations_async.py | 2 +- ...esource_management_providers_operations.py | 2 +- ...e_management_providers_operations_async.py | 2 +- ...e_management_resource_groups_operations.py | 2 +- ...gement_resource_groups_operations_async.py | 2 +- ...esource_management_resources_operations.py | 2 +- ...e_management_resources_operations_async.py | 2 +- ...est_resource_management_tags_operations.py | 2 +- ...source_management_tags_operations_async.py | 2 +- ...ink_private_link_association_operations.py | 2 +- ...ivate_link_association_operations_async.py | 2 +- ...urce_management_private_link_operations.py | 2 +- ...anagement_private_link_operations_async.py | 2 +- .../generated_tests/test_subscription.py | 2 +- .../test_subscription_async.py | 2 +- .../test_subscription_operations.py | 2 +- .../test_subscription_operations_async.py | 2 +- ...t_subscription_subscriptions_operations.py | 2 +- ...cription_subscriptions_operations_async.py | 2 +- .../test_subscription_tenants_operations.py | 2 +- ...t_subscription_tenants_operations_async.py | 2 +- sdk/resources/azure-mgmt-resource/setup.py | 5 +- 729 files changed, 36491 insertions(+), 9434 deletions(-) create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/__init__.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_configuration.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_metadata.json create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_patch.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_resource_management_client.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_version.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/__init__.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_configuration.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_patch.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_resource_management_client.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/__init__.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_operations.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_patch.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/__init__.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_models_py3.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_patch.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_resource_management_client_enums.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/__init__.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_operations.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_patch.py create mode 100644 sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/py.typed diff --git a/sdk/resources/azure-mgmt-resource/CHANGELOG.md b/sdk/resources/azure-mgmt-resource/CHANGELOG.md index 313832d37ce3..94e4a45fbe38 100644 --- a/sdk/resources/azure-mgmt-resource/CHANGELOG.md +++ b/sdk/resources/azure-mgmt-resource/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 23.4.0 (2025-04-22) + +### Features Added + + - Model DeploymentProperties has a new parameter extension_configs + - Model DeploymentPropertiesExtended has a new parameter extensions + - Model DeploymentWhatIfProperties has a new parameter extension_configs + - Model ResourceReference has a new parameter api_version + - Model ResourceReference has a new parameter extension + - Model ResourceReference has a new parameter identifiers + - Model ResourceReference has a new parameter resource_type + - Model TargetResource has a new parameter api_version + - Model TargetResource has a new parameter extension + - Model TargetResource has a new parameter identifiers + - Model TargetResource has a new parameter symbolic_name + ## 23.3.0 (2025-02-24) ### Features Added diff --git a/sdk/resources/azure-mgmt-resource/README.md b/sdk/resources/azure-mgmt-resource/README.md index 9763b6699cf7..675ec9531260 100644 --- a/sdk/resources/azure-mgmt-resource/README.md +++ b/sdk/resources/azure-mgmt-resource/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Resource Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/resources/azure-mgmt-resource/_meta.json b/sdk/resources/azure-mgmt-resource/_meta.json index 8eb9f8f99596..f9f4fe80cd1f 100644 --- a/sdk/resources/azure-mgmt-resource/_meta.json +++ b/sdk/resources/azure-mgmt-resource/_meta.json @@ -1,12 +1,12 @@ { - "commit": "39879dbcfe0d8d66afbe073f287cf8f246928243", + "commit": "49b4fb63211bd06845c3a2475816116726a64ff2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ - "@autorest/python@6.27.4", + "@autorest/python@6.33.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.27.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/resources/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.33.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/resources/resource-manager/readme.md", "package-privatelinks-2020-05": "2022-03-18 16:14:07 -0700 2c68b6f0c9566d97d9d590a31b0d46997622eef7 Microsoft.Authorization/stable/2020-05-01/privateLinks.json", "package-features-2021-07": "2022-03-06 17:36:42 -0800 6a57e9cedc87cafd2dc9e4f3e8af62b5725e3d22 Microsoft.Features/stable/2021-07-01/features.json", diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/__init__.py index deee345ef011..d55ccad1f573 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/__init__.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/__init__.py @@ -1,31 +1 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for 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 .managedapplications import ApplicationClient -from .deploymentscripts import DeploymentScriptsClient -from .features import FeatureClient -from .links import ManagementLinkClient -from .locks import ManagementLockClient -from .policy import PolicyClient -from .resources import ResourceManagementClient -from .subscriptions import SubscriptionClient -from .deploymentstacks import DeploymentStacksClient -from .databoundaries import DataBoundaryMgmtClient - -__all__ = [ - "ApplicationClient", - "DeploymentScriptsClient", - "FeatureClient", - "PolicyClient", - "ManagementLinkClient", - "ManagementLockClient", - "ResourceManagementClient", - "SubscriptionClient", - "DeploymentStacksClient", - "DataBoundaryMgmtClient", -] +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_changes_client.py index 7351fb379d19..a20f622ae569 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_changes_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ChangesClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ChangesClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ChangesClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_changes_client.py index aa9221bfd915..2c67e88766dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/aio/_changes_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ChangesClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ChangesClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ChangesClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py index 4f79edffe2ce..f1331803e826 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_changes_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ChangesClient: :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. @@ -42,13 +44,17 @@ class ChangesClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ChangesClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ChangesClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +73,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json index 680813300bca..2c0e4bde9037 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ChangesClient", "filename": "_changes_client", "description": "The Resource Changes Client.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ChangesClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ChangesClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ChangesClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ChangesClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py index a177262cf552..0a421d72c0b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/_changes_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ChangesClient: :param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000). Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this default value may result in unsupported behavior. @@ -42,13 +44,17 @@ class ChangesClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ChangesClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ChangesClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +73,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/operations/_operations.py index 8138f9d9cc40..877a5e07417c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,12 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import build_changes_get_request, build_changes_list_request +from .._configuration import ChangesClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,10 +49,10 @@ class ChangesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ChangesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py index 3b8671e413dd..626972d1528b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/models/_models_py3.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -50,11 +51,11 @@ class ChangeAttributes(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.correlation_id = None - self.timestamp = None - self.changes_count = None - self.previous_resource_snapshot_id = None - self.new_resource_snapshot_id = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[str] = None + self.changes_count: Optional[int] = None + self.previous_resource_snapshot_id: Optional[str] = None + self.new_resource_snapshot_id: Optional[str] = None class ChangeBase(_serialization.Model): @@ -91,10 +92,10 @@ class ChangeBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.property_change_type = None - self.change_category = None - self.previous_value = None - self.new_value = None + self.property_change_type: Optional[Union[str, "_models.PropertyChangeType"]] = None + self.change_category: Optional[Union[str, "_models.ChangeCategory"]] = None + self.previous_value: Optional[str] = None + self.new_value: Optional[str] = None class ChangeProperties(_serialization.Model): @@ -145,9 +146,9 @@ def __init__( :paramtype changes: dict[str, ~azure.mgmt.resource.changes.v2022_05_01.models.ChangeBase] """ super().__init__(**kwargs) - self.target_resource_id = None - self.target_resource_type = None - self.change_type = None + self.target_resource_id: Optional[str] = None + self.target_resource_type: Optional[str] = None + self.change_type: Optional[Union[str, "_models.ChangeType"]] = None self.change_attributes = change_attributes self.changes = changes @@ -190,7 +191,7 @@ class Resource(_serialization.Model): 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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -214,9 +215,9 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class ChangeResourceResult(Resource): @@ -225,7 +226,7 @@ class ChangeResourceResult(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}. # pylint: disable=line-too-long + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -282,8 +283,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -323,11 +324,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/operations/_operations.py index 6546928703d4..9dc610e2ea0c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/changes/v2022_05_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,12 +27,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ChangesClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -59,7 +58,7 @@ def build_changes_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -102,7 +101,7 @@ def build_changes_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Resources/changes/{changeResourceId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), @@ -137,10 +136,10 @@ class ChangesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ChangesClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_data_boundary_mgmt_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_data_boundary_mgmt_client.py index f09cb9682905..ddbb85b6ede8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_data_boundary_mgmt_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_data_boundary_mgmt_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -66,13 +68,18 @@ def __init__( self, credential: "TokenCredential", api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = DataBoundaryMgmtClientConfiguration(credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataBoundaryMgmtClientConfiguration(credential, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -91,7 +98,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DataBoundaryMgmtClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/aio/_data_boundary_mgmt_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/aio/_data_boundary_mgmt_client.py index 40ffc3d345ee..f5f952e3a28f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/aio/_data_boundary_mgmt_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/aio/_data_boundary_mgmt_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -66,13 +68,18 @@ def __init__( self, credential: "AsyncTokenCredential", api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = DataBoundaryMgmtClientConfiguration(credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataBoundaryMgmtClientConfiguration(credential, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -91,7 +98,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DataBoundaryMgmtClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_data_boundary_mgmt_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_data_boundary_mgmt_client.py index 092d4cc5266f..c7faf864a97c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_data_boundary_mgmt_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_data_boundary_mgmt_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -32,17 +34,23 @@ class DataBoundaryMgmtClient: azure.mgmt.resource.databoundaries.v2024_08_01.operations.DataBoundariesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = DataBoundaryMgmtClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataBoundaryMgmtClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -61,7 +69,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_metadata.json index 7f5a39b603af..d0cc47161b48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DataBoundaryMgmtClient", "filename": "_data_boundary_mgmt_client", "description": "Provides APIs for data boundary operations.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoundaryMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DataBoundaryMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DataBoundaryMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DataBoundaryMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/_data_boundary_mgmt_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/_data_boundary_mgmt_client.py index 618f56f1b4b8..dd86b808006e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/_data_boundary_mgmt_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/_data_boundary_mgmt_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -32,17 +34,23 @@ class DataBoundaryMgmtClient: azure.mgmt.resource.databoundaries.v2024_08_01.aio.operations.DataBoundariesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-08-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = DataBoundaryMgmtClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DataBoundaryMgmtClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -61,7 +69,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/operations/_operations.py index 05dae662698c..506aec9257fd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,16 +25,14 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_data_boundaries_get_scope_request, build_data_boundaries_get_tenant_request, build_data_boundaries_put_request, ) +from .._configuration import DataBoundaryMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -52,10 +51,10 @@ class DataBoundariesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataBoundaryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/models/_models_py3.py index 79e1a6eb03c6..06dec1a9cf54 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/models/_models_py3.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -21,7 +22,7 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -50,10 +51,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ProxyResource(Resource): @@ -63,7 +64,7 @@ class ProxyResource(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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -82,7 +83,7 @@ class DataBoundaryDefinition(ProxyResource): Variables are only populated by the server, and will be ignored when sending a request. :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -155,7 +156,7 @@ def __init__(self, *, data_boundary: Optional[Union[str, "_models.DataBoundary"] """ super().__init__(**kwargs) self.data_boundary = data_boundary - self.provisioning_state = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class ErrorAdditionalInfo(_serialization.Model): @@ -182,8 +183,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -223,11 +224,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/operations/_operations.py index ee6addacf836..d34d98b11783 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/databoundaries/v2024_08_01/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +25,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DataBoundaryMgmtClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -129,10 +127,10 @@ class DataBoundariesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DataBoundaryMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py index 037dddd0918b..4c088b789ef4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_deployment_scripts_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = DeploymentScriptsClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DeploymentScriptsClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DeploymentScriptsClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/aio/_deployment_scripts_client.py index a12e8bf54b65..df0d7354d264 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/aio/_deployment_scripts_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = DeploymentScriptsClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DeploymentScriptsClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DeploymentScriptsClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py index 3459ca44b802..4146e7291abf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-10-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json index 156be6e388a1..5e89dc6c47de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "DeploymentScriptsClient", "filename": "_deployment_scripts_client", "description": "The APIs listed in this specification can be used to manage Deployment Scripts resource through the Azure Resource Manager.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py index 661a04c47894..d45787730425 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-10-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py index a42e0f8467b6..638637e333d4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_scripts_create_request, build_deployment_scripts_delete_request, @@ -41,11 +44,8 @@ build_deployment_scripts_list_by_subscription_request, build_deployment_scripts_update_request, ) +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +64,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_initial( @@ -149,7 +149,6 @@ async def begin_create( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -180,7 +179,6 @@ async def begin_create( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -208,7 +206,6 @@ async def begin_create( deployment_script: Union[_models.DeploymentScript, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -531,7 +528,6 @@ async def delete(self, resource_group_name: str, script_name: str, **kwargs: Any @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists all deployment scripts for a given subscription. :return: An iterator like instance of either DeploymentScript or the result of cls(response) @@ -735,7 +731,6 @@ async def get_logs_default( def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py index adf2f08d9c28..eb3abf8d21f3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/models/_models_py3.py @@ -44,9 +44,9 @@ class AzureResourceBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DeploymentScript(AzureResourceBase): @@ -129,7 +129,7 @@ def __init__( self.location = location self.tags = tags self.kind: Optional[str] = None - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class AzureCliScript(DeploymentScript): @@ -320,9 +320,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -495,9 +495,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurationBase): @@ -661,9 +661,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzurePowerShellScript(DeploymentScript): @@ -854,9 +854,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -1029,9 +1029,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class ContainerConfiguration(_serialization.Model): @@ -1105,7 +1105,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentScriptsError(_serialization.Model): @@ -1232,8 +1232,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1275,11 +1275,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ManagedServiceIdentity(_serialization.Model): @@ -1326,7 +1326,7 @@ def __init__( """ super().__init__(**kwargs) self.type = type - self.tenant_id = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -1362,7 +1362,7 @@ class ScriptLog(AzureResourceBase): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.log = None + self.log: Optional[str] = None class ScriptLogsList(_serialization.Model): @@ -1430,11 +1430,11 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: ~azure.mgmt.resource.deploymentscripts.v2019_10_01_preview.models.ErrorResponse """ super().__init__(**kwargs) - self.container_instance_id = None - self.storage_account_id = None - self.start_time = None - self.end_time = None - self.expiration_time = None + self.container_instance_id: Optional[str] = None + self.storage_account_id: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.expiration_time: Optional[datetime.datetime] = None self.error = error @@ -1559,5 +1559,5 @@ class UserAssignedIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py index b93c20e78320..6a1197ea270c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2019_10_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_deployment_scripts_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -94,7 +92,7 @@ def build_deployment_scripts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -129,7 +127,7 @@ def build_deployment_scripts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -162,7 +160,7 @@ def build_deployment_scripts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -221,7 +219,7 @@ def build_deployment_scripts_get_logs_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -254,7 +252,7 @@ def build_deployment_scripts_get_logs_default_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -289,7 +287,7 @@ def build_deployment_scripts_list_by_resource_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -322,10 +320,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_initial( @@ -407,7 +405,6 @@ def begin_create( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -438,7 +435,6 @@ def begin_create( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -466,7 +462,6 @@ def begin_create( deployment_script: Union[_models.DeploymentScript, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeploymentScript]: - # pylint: disable=line-too-long """Creates a deployment script. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -791,7 +786,6 @@ def delete( # pylint: disable=inconsistent-return-statements @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists all deployment scripts for a given subscription. :return: An iterator like instance of either DeploymentScript or the result of cls(response) @@ -993,7 +987,6 @@ def get_logs_default( @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py index b166a41584a0..71855ed9094a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json index 15776228f9fd..1cfc114abafe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DeploymentScriptsClient", "filename": "_deployment_scripts_client", "description": "The APIs listed in this specification can be used to manage Deployment Scripts resource through the Azure Resource Manager.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py index 963feb2fccc6..5a222889e1dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py index 033358df8728..4e0590dbab00 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_scripts_create_request, build_deployment_scripts_delete_request, @@ -41,11 +44,8 @@ build_deployment_scripts_list_by_subscription_request, build_deployment_scripts_update_request, ) +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +64,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_initial( @@ -518,7 +518,6 @@ async def delete(self, resource_group_name: str, script_name: str, **kwargs: Any @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists all deployment scripts for a given subscription. :return: An iterator like instance of either DeploymentScript or the result of cls(response) @@ -716,7 +715,6 @@ async def get_logs_default( def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py index 880c1c38bda7..e7e2ffe3f222 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/models/_models_py3.py @@ -44,9 +44,9 @@ class AzureResourceBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DeploymentScript(AzureResourceBase): @@ -126,7 +126,7 @@ def __init__( self.location = location self.tags = tags self.kind: Optional[str] = None - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class AzureCliScript(DeploymentScript): @@ -313,9 +313,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -487,9 +487,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurationBase): @@ -652,9 +652,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzurePowerShellScript(DeploymentScript): @@ -841,9 +841,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -1015,9 +1015,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class ContainerConfiguration(_serialization.Model): @@ -1091,7 +1091,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentScriptsError(_serialization.Model): @@ -1217,8 +1217,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1259,11 +1259,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ManagedServiceIdentity(_serialization.Model): @@ -1310,7 +1310,7 @@ def __init__( """ super().__init__(**kwargs) self.type = type - self.tenant_id = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -1346,7 +1346,7 @@ class ScriptLog(AzureResourceBase): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.log = None + self.log: Optional[str] = None class ScriptLogsList(_serialization.Model): @@ -1411,11 +1411,11 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: :paramtype error: ~azure.mgmt.resource.deploymentscripts.v2020_10_01.models.ErrorResponse """ super().__init__(**kwargs) - self.container_instance_id = None - self.storage_account_id = None - self.start_time = None - self.end_time = None - self.expiration_time = None + self.container_instance_id: Optional[str] = None + self.storage_account_id: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.expiration_time: Optional[datetime.datetime] = None self.error = error @@ -1540,5 +1540,5 @@ class UserAssignedIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py index 2507cb553b76..a9e304ff5840 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2020_10_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_deployment_scripts_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -94,7 +92,7 @@ def build_deployment_scripts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -129,7 +127,7 @@ def build_deployment_scripts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -162,7 +160,7 @@ def build_deployment_scripts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -221,7 +219,7 @@ def build_deployment_scripts_get_logs_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -254,7 +252,7 @@ def build_deployment_scripts_get_logs_default_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -289,7 +287,7 @@ def build_deployment_scripts_list_by_resource_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -322,10 +320,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_initial( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_deployment_scripts_client.py index bbd58c529df4..dac14f46da90 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_metadata.json index f48ac5c9a362..6319cc8ae8d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DeploymentScriptsClient", "filename": "_deployment_scripts_client", "description": "The APIs listed in this specification can be used to manage Deployment Scripts resource through the Azure Resource Manager.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentScriptsClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/_deployment_scripts_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/_deployment_scripts_client.py index 6e17a694414a..bf5290623d48 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/_deployment_scripts_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/_deployment_scripts_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class DeploymentScriptsClient: :param subscription_id: Subscription Id which forms part of the URI for every service call. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-08-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class DeploymentScriptsClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentScriptsClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/operations/_operations.py index 6fcbd6909dda..b884de4d0312 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -31,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_scripts_create_request, build_deployment_scripts_delete_request, @@ -41,11 +44,8 @@ build_deployment_scripts_list_by_subscription_request, build_deployment_scripts_update_request, ) +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +64,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _create_initial( @@ -518,7 +518,6 @@ async def delete(self, resource_group_name: str, script_name: str, **kwargs: Any @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists all deployment scripts for a given subscription. :return: An iterator like instance of either DeploymentScript or the result of cls(response) @@ -716,7 +715,6 @@ async def get_logs_default( def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentScript"]: - # pylint: disable=line-too-long """Lists deployments scripts. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/models/_models_py3.py index 56aec5ebdb9b..5b5d2ebbc96d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/models/_models_py3.py @@ -44,9 +44,9 @@ class AzureResourceBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class DeploymentScript(AzureResourceBase): @@ -126,7 +126,7 @@ def __init__( self.location = location self.tags = tags self.kind: Optional[str] = None - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None class AzureCliScript(DeploymentScript): @@ -313,9 +313,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -487,9 +487,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzureCliScriptProperties(DeploymentScriptPropertiesBase, ScriptConfigurationBase): @@ -652,9 +652,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class AzurePowerShellScript(DeploymentScript): @@ -841,9 +841,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None self.primary_script_uri = primary_script_uri self.supporting_script_uris = supporting_script_uris self.script_content = script_content @@ -1015,9 +1015,9 @@ def __init__( self.container_settings = container_settings self.storage_account_settings = storage_account_settings self.cleanup_preference = cleanup_preference - self.provisioning_state = None - self.status = None - self.outputs = None + self.provisioning_state: Optional[Union[str, "_models.ScriptProvisioningState"]] = None + self.status: Optional["_models.ScriptStatus"] = None + self.outputs: Optional[Dict[str, JSON]] = None class ContainerConfiguration(_serialization.Model): @@ -1139,7 +1139,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentScript"]] = None, """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentScriptsError(_serialization.Model): @@ -1265,8 +1265,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1307,11 +1307,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ManagedServiceIdentity(_serialization.Model): @@ -1358,7 +1358,7 @@ def __init__( """ super().__init__(**kwargs) self.type = type - self.tenant_id = None + self.tenant_id: Optional[str] = None self.user_assigned_identities = user_assigned_identities @@ -1394,7 +1394,7 @@ class ScriptLog(AzureResourceBase): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.log = None + self.log: Optional[str] = None class ScriptLogsList(_serialization.Model): @@ -1459,11 +1459,11 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: :paramtype error: ~azure.mgmt.resource.deploymentscripts.v2023_08_01.models.ErrorResponse """ super().__init__(**kwargs) - self.container_instance_id = None - self.storage_account_id = None - self.start_time = None - self.end_time = None - self.expiration_time = None + self.container_instance_id: Optional[str] = None + self.storage_account_id: Optional[str] = None + self.start_time: Optional[datetime.datetime] = None + self.end_time: Optional[datetime.datetime] = None + self.expiration_time: Optional[datetime.datetime] = None self.error = error @@ -1588,5 +1588,5 @@ class UserAssignedIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/operations/_operations.py index b1777602b667..79810137582d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentscripts/v2023_08_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DeploymentScriptsClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -58,7 +56,7 @@ def build_deployment_scripts_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -94,7 +92,7 @@ def build_deployment_scripts_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -129,7 +127,7 @@ def build_deployment_scripts_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -162,7 +160,7 @@ def build_deployment_scripts_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -221,7 +219,7 @@ def build_deployment_scripts_get_logs_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -254,7 +252,7 @@ def build_deployment_scripts_get_logs_default_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts/{scriptName}/logs/default", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -289,7 +287,7 @@ def build_deployment_scripts_list_by_resource_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentScripts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -322,10 +320,10 @@ class DeploymentScriptsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentScriptsClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _create_initial( diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_deployment_stacks_client.py index 527b1c9bcd78..ab26d2241ef2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_deployment_stacks_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = DeploymentStacksClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DeploymentStacksClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DeploymentStacksClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/aio/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/aio/_deployment_stacks_client.py index 8e69ace69b44..baba7e114bde 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/aio/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/aio/_deployment_stacks_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = DeploymentStacksClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = DeploymentStacksClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(DeploymentStacksClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_deployment_stacks_client.py index 3434106eb528..7be025c670b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_deployment_stacks_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class DeploymentStacksClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class DeploymentStacksClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentStacksClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_metadata.json index 04ec24431be0..c34ec36df8d1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "DeploymentStacksClient", "filename": "_deployment_stacks_client", "description": "The APIs listed in this specification can be used to manage deployment stack resources through the Azure Resource Manager.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/_deployment_stacks_client.py index 79c870f1f4f0..ecbce986f35c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/_deployment_stacks_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class DeploymentStacksClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class DeploymentStacksClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentStacksClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/operations/_operations.py index 3ae7023d5f39..aad7d2edd446 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_stacks_create_or_update_at_management_group_request, build_deployment_stacks_create_or_update_at_resource_group_request, @@ -49,11 +51,8 @@ build_deployment_stacks_list_at_resource_group_request, build_deployment_stacks_list_at_subscription_request, ) +from .._configuration import DeploymentStacksClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,17 +71,16 @@ class DeploymentStacksOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentStacksClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_at_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment Stacks within the specified resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -165,7 +163,6 @@ async def get_next(next_link=None): @distributed_trace def list_at_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment Stacks within the specified subscription. :return: An iterator like instance of either DeploymentStack or the result of cls(response) @@ -246,7 +243,6 @@ async def get_next(next_link=None): def list_at_management_group( self, management_group_id: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment Stacks within the specified management group. :param management_group_id: Management Group. Required. @@ -404,7 +400,6 @@ async def begin_create_or_update_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -435,7 +430,6 @@ async def begin_create_or_update_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -463,7 +457,6 @@ async def begin_create_or_update_at_resource_group( deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -805,7 +798,6 @@ async def begin_create_or_update_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param deployment_stack_name: Name of the deployment stack. Required. @@ -832,7 +824,6 @@ async def begin_create_or_update_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param deployment_stack_name: Name of the deployment stack. Required. @@ -853,7 +844,6 @@ async def begin_create_or_update_at_subscription( async def begin_create_or_update_at_subscription( self, deployment_stack_name: str, deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param deployment_stack_name: Name of the deployment stack. Required. @@ -1183,7 +1173,6 @@ async def begin_create_or_update_at_management_group( # pylint: disable=name-to content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param management_group_id: Management Group. Required. @@ -1213,7 +1202,6 @@ async def begin_create_or_update_at_management_group( # pylint: disable=name-to content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param management_group_id: Management Group. Required. @@ -1240,7 +1228,6 @@ async def begin_create_or_update_at_management_group( # pylint: disable=name-to deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStack]: - # pylint: disable=line-too-long """Creates or updates a Deployment Stack. :param management_group_id: Management Group. Required. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/models/_models_py3.py index 964882cbbba2..22066ab491e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/models/_models_py3.py @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AzureResourceBase(_serialization.Model): @@ -57,10 +52,10 @@ class AzureResourceBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class DenySettings(_serialization.Model): @@ -344,14 +339,14 @@ def __init__( # pylint: disable=too-many-locals self.deployment_scope = deployment_scope self.description = description self.deny_settings = deny_settings - self.provisioning_state = None - self.detached_resources = None - self.deleted_resources = None - self.failed_resources = None - self.resources = None - self.deployment_id = None - self.outputs = None - self.duration = None + self.provisioning_state: Optional[Union[str, "_models.DeploymentStackProvisioningState"]] = None + self.detached_resources: Optional[List["_models.ResourceReference"]] = None + self.deleted_resources: Optional[List["_models.ResourceReference"]] = None + self.failed_resources: Optional[List["_models.ResourceReferenceExtended"]] = None + self.resources: Optional[List["_models.ManagedResourceReference"]] = None + self.deployment_id: Optional[str] = None + self.outputs: Optional[JSON] = None + self.duration: Optional[str] = None class DeploymentStackListResult(_serialization.Model): @@ -383,7 +378,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentStack"]] = None, * """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentStacksError(_serialization.Model): @@ -588,14 +583,14 @@ def __init__( self.deployment_scope = deployment_scope self.description = description self.deny_settings = deny_settings - self.provisioning_state = None - self.detached_resources = None - self.deleted_resources = None - self.failed_resources = None - self.resources = None - self.deployment_id = None - self.outputs = None - self.duration = None + self.provisioning_state: Optional[Union[str, "_models.DeploymentStackProvisioningState"]] = None + self.detached_resources: Optional[List["_models.ResourceReference"]] = None + self.deleted_resources: Optional[List["_models.ResourceReference"]] = None + self.failed_resources: Optional[List["_models.ResourceReferenceExtended"]] = None + self.resources: Optional[List["_models.ManagedResourceReference"]] = None + self.deployment_id: Optional[str] = None + self.outputs: Optional[JSON] = None + self.duration: Optional[str] = None class DeploymentStackPropertiesActionOnUnmanage(_serialization.Model): # pylint: disable=name-too-long @@ -850,8 +845,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -892,11 +887,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -940,7 +935,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ManagedResourceReference(ResourceReference): @@ -1024,7 +1019,7 @@ def __init__(self, *, error: Optional["_models.ErrorResponse"] = None, **kwargs: """ super().__init__(error=error, **kwargs) self.error = error - self.id = None + self.id: Optional[str] = None class SystemData(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/operations/_operations.py index 6dc0fc409a41..61f7ce337354 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2022_08_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DeploymentStacksClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +55,7 @@ def build_deployment_stacks_list_at_resource_group_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -115,7 +113,7 @@ def build_deployment_stacks_list_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -147,7 +145,7 @@ def build_deployment_stacks_create_or_update_at_resource_group_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -189,7 +187,7 @@ def build_deployment_stacks_get_at_resource_group_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -235,7 +233,7 @@ def build_deployment_stacks_delete_at_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -284,7 +282,7 @@ def build_deployment_stacks_create_or_update_at_subscription_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "deploymentStackName": _SERIALIZER.url( @@ -323,7 +321,7 @@ def build_deployment_stacks_get_at_subscription_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "deploymentStackName": _SERIALIZER.url( @@ -365,7 +363,7 @@ def build_deployment_stacks_delete_at_subscription_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "deploymentStackName": _SERIALIZER.url( @@ -411,7 +409,7 @@ def build_deployment_stacks_create_or_update_at_management_group_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -452,7 +450,7 @@ def build_deployment_stacks_get_at_management_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -497,7 +495,7 @@ def build_deployment_stacks_delete_at_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -548,7 +546,7 @@ def build_deployment_stacks_export_template_at_resource_group_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "resourceGroupName": _SERIALIZER.url( @@ -588,7 +586,7 @@ def build_deployment_stacks_export_template_at_subscription_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), "deploymentStackName": _SERIALIZER.url( @@ -625,7 +623,7 @@ def build_deployment_stacks_export_template_at_management_group_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -665,10 +663,10 @@ class DeploymentStacksOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentStacksClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_deployment_stacks_client.py index 7c42f1c96646..547a3b61bbb9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_deployment_stacks_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class DeploymentStacksClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class DeploymentStacksClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentStacksClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_metadata.json index 237009bba10d..4a6cf9b03fb5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "DeploymentStacksClient", "filename": "_deployment_stacks_client", "description": "The APIs listed in this specification can be used to manage Deployment stack resources through the Azure Resource Manager.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"DeploymentStacksClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/_deployment_stacks_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/_deployment_stacks_client.py index d472703c6653..e390115ef70e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/_deployment_stacks_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/_deployment_stacks_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class DeploymentStacksClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-03-01". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class DeploymentStacksClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = DeploymentStacksClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/operations/_operations.py index 15ac1647f7dd..600d91f27912 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_stacks_create_or_update_at_management_group_request, build_deployment_stacks_create_or_update_at_resource_group_request, @@ -52,11 +54,8 @@ build_deployment_stacks_validate_stack_at_resource_group_request, build_deployment_stacks_validate_stack_at_subscription_request, ) +from .._configuration import DeploymentStacksClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -75,17 +74,16 @@ class DeploymentStacksOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentStacksClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_at_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment stacks within the specified Resource Group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -166,7 +164,6 @@ async def get_next(next_link=None): @distributed_trace def list_at_subscription(self, **kwargs: Any) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment stacks within the specified Subscription. :return: An iterator like instance of either DeploymentStack or the result of cls(response) @@ -245,7 +242,6 @@ async def get_next(next_link=None): def list_at_management_group( self, management_group_id: str, **kwargs: Any ) -> AsyncIterable["_models.DeploymentStack"]: - # pylint: disable=line-too-long """Lists all the Deployment stacks within the specified Management Group. :param management_group_id: Management Group id. Required. @@ -1760,7 +1756,6 @@ async def begin_validate_stack_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -1792,7 +1787,6 @@ async def begin_validate_stack_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -1821,7 +1815,6 @@ async def begin_validate_stack_at_resource_group( deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -1965,7 +1958,6 @@ async def begin_validate_stack_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -1993,7 +1985,6 @@ async def begin_validate_stack_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2015,7 +2006,6 @@ async def begin_validate_stack_at_subscription( async def begin_validate_stack_at_subscription( self, deployment_stack_name: str, deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2160,7 +2150,6 @@ async def begin_validate_stack_at_management_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2191,7 +2180,6 @@ async def begin_validate_stack_at_management_group( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2219,7 +2207,6 @@ async def begin_validate_stack_at_management_group( deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/models/_models_py3.py index 963267c9e631..7d698ba2958d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/models/_models_py3.py @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ActionOnUnmanage(_serialization.Model): @@ -120,10 +115,10 @@ class AzureResourceBase(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class DenySettings(_serialization.Model): @@ -460,15 +455,15 @@ def __init__( # pylint: disable=too-many-locals self.deployment_scope = deployment_scope self.description = description self.deny_settings = deny_settings - self.provisioning_state = None - self.correlation_id = None - self.detached_resources = None - self.deleted_resources = None - self.failed_resources = None - self.resources = None - self.deployment_id = None - self.outputs = None - self.duration = None + self.provisioning_state: Optional[Union[str, "_models.DeploymentStackProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.detached_resources: Optional[List["_models.ResourceReference"]] = None + self.deleted_resources: Optional[List["_models.ResourceReference"]] = None + self.failed_resources: Optional[List["_models.ResourceReferenceExtended"]] = None + self.resources: Optional[List["_models.ManagedResourceReference"]] = None + self.deployment_id: Optional[str] = None + self.outputs: Optional[JSON] = None + self.duration: Optional[str] = None class DeploymentStackListResult(_serialization.Model): @@ -499,7 +494,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentStack"]] = None, * """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentStacksError(_serialization.Model): @@ -716,15 +711,15 @@ def __init__( self.deployment_scope = deployment_scope self.description = description self.deny_settings = deny_settings - self.provisioning_state = None - self.correlation_id = None - self.detached_resources = None - self.deleted_resources = None - self.failed_resources = None - self.resources = None - self.deployment_id = None - self.outputs = None - self.duration = None + self.provisioning_state: Optional[Union[str, "_models.DeploymentStackProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.detached_resources: Optional[List["_models.ResourceReference"]] = None + self.deleted_resources: Optional[List["_models.ResourceReference"]] = None + self.failed_resources: Optional[List["_models.ResourceReferenceExtended"]] = None + self.resources: Optional[List["_models.ManagedResourceReference"]] = None + self.deployment_id: Optional[str] = None + self.outputs: Optional[JSON] = None + self.duration: Optional[str] = None class DeploymentStacksDebugSetting(_serialization.Model): @@ -1032,10 +1027,10 @@ def __init__( super().__init__(error=error, **kwargs) self.error = error self.properties = properties - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ErrorAdditionalInfo(_serialization.Model): @@ -1062,8 +1057,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -1103,11 +1098,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class KeyVaultParameterReference(_serialization.Model): @@ -1203,7 +1198,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ManagedResourceReference(ResourceReference): @@ -1285,7 +1280,7 @@ def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: A """ super().__init__(error=error, **kwargs) self.error = error - self.id = None + self.id: Optional[str] = None class SystemData(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/operations/_operations.py index 3ff262731289..a0d621657cf1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/deploymentstacks/v2024_03_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,12 +32,9 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import DeploymentStacksClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -57,7 +55,7 @@ def build_deployment_stacks_list_at_resource_group_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -115,7 +113,7 @@ def build_deployment_stacks_list_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -147,7 +145,7 @@ def build_deployment_stacks_create_or_update_at_resource_group_request( # pylin _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -189,7 +187,7 @@ def build_deployment_stacks_get_at_resource_group_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -237,7 +235,7 @@ def build_deployment_stacks_delete_at_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -294,7 +292,7 @@ def build_deployment_stacks_create_or_update_at_subscription_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "deploymentStackName": _SERIALIZER.url( @@ -333,7 +331,7 @@ def build_deployment_stacks_get_at_subscription_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "deploymentStackName": _SERIALIZER.url( @@ -377,7 +375,7 @@ def build_deployment_stacks_delete_at_subscription_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "deploymentStackName": _SERIALIZER.url( @@ -431,7 +429,7 @@ def build_deployment_stacks_create_or_update_at_management_group_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -472,7 +470,7 @@ def build_deployment_stacks_get_at_management_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -518,7 +516,7 @@ def build_deployment_stacks_delete_at_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -573,7 +571,7 @@ def build_deployment_stacks_export_template_at_resource_group_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -613,7 +611,7 @@ def build_deployment_stacks_export_template_at_subscription_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "deploymentStackName": _SERIALIZER.url( @@ -650,7 +648,7 @@ def build_deployment_stacks_export_template_at_management_group_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -690,7 +688,7 @@ def build_deployment_stacks_validate_stack_at_resource_group_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -733,7 +731,7 @@ def build_deployment_stacks_validate_stack_at_subscription_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "deploymentStackName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployment_stacks_validate_stack_at_management_group_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Resources/deploymentStacks/{deploymentStackName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url( "management_group_id", management_group_id, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -815,10 +813,10 @@ class DeploymentStacksOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: DeploymentStacksClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2490,7 +2488,6 @@ def begin_validate_stack_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2522,7 +2519,6 @@ def begin_validate_stack_at_resource_group( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2551,7 +2547,6 @@ def begin_validate_stack_at_resource_group( deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Resource Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2695,7 +2690,6 @@ def begin_validate_stack_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2723,7 +2717,6 @@ def begin_validate_stack_at_subscription( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2745,7 +2738,6 @@ def begin_validate_stack_at_subscription( def begin_validate_stack_at_subscription( self, deployment_stack_name: str, deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Subscription scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2890,7 +2882,6 @@ def begin_validate_stack_at_management_group( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2921,7 +2912,6 @@ def begin_validate_stack_at_management_group( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. @@ -2949,7 +2939,6 @@ def begin_validate_stack_at_management_group( deployment_stack: Union[_models.DeploymentStack, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.DeploymentStackValidateResult]: - # pylint: disable=line-too-long """Runs preflight validation on the Management Group scoped Deployment stack template to verify its acceptance to Azure Resource Manager. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_feature_client.py index 5de2899871e8..6ea6a473528e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_feature_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = FeatureClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(FeatureClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_feature_client.py index 6e4b76394089..daa17bc48209 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/aio/_feature_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -70,13 +72,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = FeatureClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(FeatureClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py index a59b2c6d4913..54afb99a4844 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_feature_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class FeatureClient(FeatureClientOperationsMixin): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-12-01". Note that overriding this default value may result in unsupported behavior. @@ -44,13 +46,17 @@ class FeatureClient(FeatureClientOperationsMixin): """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = FeatureClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json index ab2d85ab8fc5..277864d78d4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "FeatureClient", "filename": "_feature_client", "description": "Azure Feature Exposure Control (AFEC) provides a mechanism for the resource providers to control feature exposure to users. Resource providers typically use this mechanism to provide public/private preview for new features prior to making them generally available. Users need to explicitly register for AFEC features to get access to such functionality.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -108,8 +108,8 @@ "features": "FeaturesOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py index 5aefa16c71a9..0d84ed0a410e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/_feature_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -36,7 +38,7 @@ class FeatureClient(FeatureClientOperationsMixin): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-12-01". Note that overriding this default value may result in unsupported behavior. @@ -44,13 +46,17 @@ class FeatureClient(FeatureClientOperationsMixin): """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = FeatureClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +75,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_operations.py index 4a9d05d62040..03a4a1504da9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -26,6 +28,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_feature_list_operations_request, build_features_get_request, @@ -34,12 +37,9 @@ build_features_register_request, build_features_unregister_request, ) +from .._configuration import FeatureClientConfiguration from .._vendor import FeatureClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -142,10 +142,10 @@ class FeaturesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_operations.py index 1603c446ca53..fe1054647f43 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2015_12_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -25,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import FeatureClientConfiguration from .._vendor import FeatureClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -93,7 +92,7 @@ def build_features_list_request(resource_provider_namespace: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -123,7 +122,7 @@ def build_features_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -154,7 +153,7 @@ def build_features_register_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -185,7 +184,7 @@ def build_features_unregister_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/unregister", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -301,10 +300,10 @@ class FeaturesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py index 2a7182a7f349..fa4b47905e4d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_feature_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -39,7 +41,7 @@ class FeatureClient(FeatureClientOperationsMixin): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this default value may result in unsupported behavior. @@ -47,13 +49,17 @@ class FeatureClient(FeatureClientOperationsMixin): """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = FeatureClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +78,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json index 61eb42672fe2..74a4ee067fb3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "FeatureClient", "filename": "_feature_client", "description": "Azure Feature Exposure Control (AFEC) provides a mechanism for the resource providers to control feature exposure to users. Resource providers typically use this mechanism to provide public/private preview for new features prior to making them generally available. Users need to explicitly register for AFEC features to get access to such functionality.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"FeatureClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"FeatureClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -109,8 +109,8 @@ "subscription_feature_registrations": "SubscriptionFeatureRegistrationsOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py index 3291e05ceec8..2e88de686881 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/_feature_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,7 +41,7 @@ class FeatureClient(FeatureClientOperationsMixin): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-07-01". Note that overriding this default value may result in unsupported behavior. @@ -47,13 +49,17 @@ class FeatureClient(FeatureClientOperationsMixin): """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = FeatureClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = FeatureClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +78,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py index b7b8d757c0e5..64cdf97e9fa2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_feature_list_operations_request, build_features_get_request, @@ -40,12 +43,9 @@ build_subscription_feature_registrations_list_all_by_subscription_request, build_subscription_feature_registrations_list_by_subscription_request, ) +from .._configuration import FeatureClientConfiguration from .._vendor import FeatureClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -149,10 +149,10 @@ class FeaturesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -496,10 +496,10 @@ class SubscriptionFeatureRegistrationsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -751,7 +751,6 @@ async def delete(self, provider_namespace: str, feature_name: str, **kwargs: Any def list_by_subscription( self, provider_namespace: str, **kwargs: Any ) -> AsyncIterable["_models.SubscriptionFeatureRegistration"]: - # pylint: disable=line-too-long """Returns subscription feature registrations for given subscription and provider namespace. :param provider_namespace: The provider namespace. Required. @@ -832,7 +831,6 @@ async def get_next(next_link=None): @distributed_trace def list_all_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.SubscriptionFeatureRegistration"]: - # pylint: disable=line-too-long """Returns subscription feature registrations for given subscription. :return: An iterator like instance of either SubscriptionFeatureRegistration or the result of diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py index 5e43737a1bae..ad579124d30e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/models/_models_py3.py @@ -50,11 +50,11 @@ class AuthorizationProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.requested_time = None - self.requester = None - self.requester_object_id = None - self.approved_time = None - self.approver = None + self.requested_time: Optional[datetime.datetime] = None + self.requester: Optional[str] = None + self.requester_object_id: Optional[str] = None + self.approved_time: Optional[datetime.datetime] = None + self.approver: Optional[str] = None class ErrorDefinition(_serialization.Model): @@ -87,8 +87,8 @@ def __init__(self, *, details: Optional[List["_models.ErrorDefinition"]] = None, :paramtype details: list[~azure.mgmt.resource.features.v2021_07_01.models.ErrorDefinition] """ super().__init__(**kwargs) - self.code = None - self.message = None + self.code: Optional[str] = None + self.message: Optional[str] = None self.details = details @@ -330,9 +330,9 @@ class ProxyResource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None class SubscriptionFeatureRegistration(ProxyResource): @@ -509,17 +509,17 @@ def __init__( :paramtype description: str """ super().__init__(**kwargs) - self.tenant_id = None - self.subscription_id = None - self.feature_name = None - self.display_name = None - self.provider_namespace = None + self.tenant_id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.feature_name: Optional[str] = None + self.display_name: Optional[str] = None + self.provider_namespace: Optional[str] = None self.state = state self.authorization_profile = authorization_profile self.metadata = metadata - self.release_date = None - self.registration_date = None - self.documentation_link = None - self.approval_type = None + self.release_date: Optional[datetime.datetime] = None + self.registration_date: Optional[datetime.datetime] = None + self.documentation_link: Optional[str] = None + self.approval_type: Optional[Union[str, "_models.SubscriptionFeatureRegistrationApprovalType"]] = None self.should_feature_display_in_portal = should_feature_display_in_portal self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py index ab7ee5f3df69..230c975aea1f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/features/v2021_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,13 +28,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import FeatureClientConfiguration from .._vendor import FeatureClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -95,7 +93,7 @@ def build_features_list_request(resource_provider_namespace: str, subscription_i _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -125,7 +123,7 @@ def build_features_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -156,7 +154,7 @@ def build_features_register_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -187,7 +185,7 @@ def build_features_unregister_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/providers/{resourceProviderNamespace}/features/{featureName}/unregister", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "featureName": _SERIALIZER.url("feature_name", feature_name, "str"), @@ -218,7 +216,7 @@ def build_subscription_feature_registrations_get_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, "str"), @@ -250,7 +248,7 @@ def build_subscription_feature_registrations_create_or_update_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, "str"), @@ -283,7 +281,7 @@ def build_subscription_feature_registrations_delete_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations/{featureName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, "str"), @@ -314,7 +312,7 @@ def build_subscription_feature_registrations_list_by_subscription_request( # py _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/featureProviders/{providerNamespace}/subscriptionFeatureRegistrations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "providerNamespace": _SERIALIZER.url("provider_namespace", provider_namespace, "str"), @@ -343,7 +341,7 @@ def build_subscription_feature_registrations_list_all_by_subscription_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Features/subscriptionFeatureRegistrations" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -458,10 +456,10 @@ class FeaturesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -801,10 +799,10 @@ class SubscriptionFeatureRegistrationsOperations: # pylint: disable=name-too-lo def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: FeatureClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_management_link_client.py index 5205fe9663e1..fa947c897efd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_management_link_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ManagementLinkClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ManagementLinkClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ManagementLinkClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/aio/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/aio/_management_link_client.py index c9216b6c5fd3..21586e2c6daa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/aio/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/aio/_management_link_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ManagementLinkClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ManagementLinkClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ManagementLinkClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py index 04f58cc9a2e6..c7b85bd11cf5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_management_link_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -39,7 +41,7 @@ class ManagementLinkClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -47,15 +49,17 @@ class ManagementLinkClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLinkClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +78,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json index b6c83c0778b0..56a7bf223be7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ManagementLinkClient", "filename": "_management_link_client", "description": "Azure resources can be linked together to form logical relationships. You can establish links between resources belonging to different resource groups. However, all the linked resources must belong to the same subscription. Each resource can be linked to 50 other resources. If any of the linked resources are deleted or moved, the link owner must clean up the remaining link.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLinkClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLinkClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLinkClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLinkClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py index 43b169184b6f..bdcef68be918 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/_management_link_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,7 +41,7 @@ class ManagementLinkClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -47,15 +49,17 @@ class ManagementLinkClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLinkClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +78,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py index 9b721c360bec..adce50d81171 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Literal, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_resource_links_create_or_update_request, @@ -35,11 +38,8 @@ build_resource_links_list_at_source_scope_request, build_resource_links_list_at_subscription_request, ) +from .._configuration import ManagementLinkClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,10 +58,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -153,15 +153,14 @@ class ResourceLinksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete(self, link_id: str, **kwargs: Any) -> None: - # pylint: disable=line-too-long """Deletes a resource link with the specified ID. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -214,7 +213,6 @@ async def delete(self, link_id: str, **kwargs: Any) -> None: async def create_or_update( self, link_id: str, parameters: _models.ResourceLink, *, content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -237,7 +235,6 @@ async def create_or_update( async def create_or_update( self, link_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -260,7 +257,6 @@ async def create_or_update( async def create_or_update( self, link_id: str, parameters: Union[_models.ResourceLink, IO[bytes]], **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -330,7 +326,6 @@ async def create_or_update( @distributed_trace_async async def get(self, link_id: str, **kwargs: Any) -> _models.ResourceLink: - # pylint: disable=line-too-long """Gets a resource link with the specified ID. :param link_id: The fully qualified Id of the resource link. For example, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py index 6b78008a4bbe..f7a837cfcfe7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/models/_models_py3.py @@ -151,9 +151,9 @@ def __init__(self, *, properties: Optional["_models.ResourceLinkProperties"] = N :paramtype properties: ~azure.mgmt.resource.links.v2016_09_01.models.ResourceLinkProperties """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[JSON] = None self.properties = properties @@ -217,7 +217,7 @@ def __init__(self, *, target_id: str, notes: Optional[str] = None, **kwargs: Any :paramtype notes: str """ super().__init__(**kwargs) - self.source_id = None + self.source_id: Optional[str] = None self.target_id = target_id self.notes = notes @@ -252,4 +252,4 @@ def __init__(self, *, value: List["_models.ResourceLink"], **kwargs: Any) -> Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py index 8c351d62bc58..ea29404c4133 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/links/v2016_09_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Literal, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ManagementLinkClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,10 +198,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -293,15 +292,14 @@ class ResourceLinksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, link_id: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements - # pylint: disable=line-too-long """Deletes a resource link with the specified ID. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -354,7 +352,6 @@ def delete(self, link_id: str, **kwargs: Any) -> None: # pylint: disable=incons def create_or_update( self, link_id: str, parameters: _models.ResourceLink, *, content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -377,7 +374,6 @@ def create_or_update( def create_or_update( self, link_id: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -400,7 +396,6 @@ def create_or_update( def create_or_update( self, link_id: str, parameters: Union[_models.ResourceLink, IO[bytes]], **kwargs: Any ) -> _models.ResourceLink: - # pylint: disable=line-too-long """Creates or updates a resource link between the specified resources. :param link_id: The fully qualified ID of the resource link. Use the format, @@ -470,7 +465,6 @@ def create_or_update( @distributed_trace def get(self, link_id: str, **kwargs: Any) -> _models.ResourceLink: - # pylint: disable=line-too-long """Gets a resource link with the specified ID. :param link_id: The fully qualified Id of the resource link. For example, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_management_lock_client.py index 614e0cedb95e..1bd2c6707bc7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_management_lock_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ManagementLockClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ManagementLockClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ManagementLockClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/aio/_management_lock_client.py index 1aa6105b1d97..f05c1f6a0a3d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/aio/_management_lock_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ManagementLockClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ManagementLockClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ManagementLockClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py index 0eb8b01baa23..532de82099a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_management_lock_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ManagementLockClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ManagementLockClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLockClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json index 9cbe7410e3d9..3d14955cf47c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ManagementLockClient", "filename": "_management_lock_client", "description": "ManagementLockClient.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py index 9fc0e9c17bac..becd7e83f2d2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/_management_lock_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -34,7 +36,7 @@ class ManagementLockClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-01-01". Note that overriding this default value may result in unsupported behavior. @@ -42,15 +44,17 @@ class ManagementLockClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLockClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -69,7 +73,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py index d0bec370a309..f3cbc27789d7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_management_locks_create_or_update_at_resource_group_level_request, build_management_locks_create_or_update_at_resource_level_request, @@ -41,11 +43,8 @@ build_management_locks_list_at_resource_level_request, build_management_locks_list_at_subscription_level_request, ) +from .._configuration import ManagementLockClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -64,10 +63,10 @@ class ManagementLocksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py index 5d24212328c3..0442ace9f7ce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/models/_models_py3.py @@ -95,8 +95,8 @@ def __init__( :paramtype notes: str """ super().__init__(**kwargs) - self.id = None - self.type = None + self.id: Optional[str] = None + self.type: Optional[str] = None self.name = name self.level = level self.notes = notes diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py index eec37a90c43a..fd4c1c520e93 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2015_01_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ManagementLockClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +52,7 @@ def build_management_locks_create_or_update_at_resource_group_level_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -86,7 +84,7 @@ def build_management_locks_delete_at_resource_group_level_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -116,7 +114,7 @@ def build_management_locks_get_at_resource_group_level_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -157,7 +155,7 @@ def build_management_locks_create_or_update_at_resource_level_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -200,7 +198,7 @@ def build_management_locks_delete_at_resource_level_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -316,7 +314,7 @@ def build_management_locks_list_at_resource_group_level_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -358,7 +356,7 @@ def build_management_locks_list_at_resource_level_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -425,10 +423,10 @@ class ManagementLocksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py index aec2ef79f97e..4fab125ff0b8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_management_lock_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class ManagementLockClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class ManagementLockClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLockClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json index b4b079a97989..16ebd2f998f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ManagementLockClient", "filename": "_management_lock_client", "description": "Azure resources can be locked to prevent other users in your organization from deleting or modifying resources.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ManagementLockClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py index a4b33a13f216..74732b462d67 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/_management_lock_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class ManagementLockClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -46,15 +48,17 @@ class ManagementLockClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ManagementLockClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -73,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py index 031317f4d3c7..a8a42f4ecbed 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_authorization_operations_list_request, build_management_locks_create_or_update_at_resource_group_level_request, @@ -47,11 +49,8 @@ build_management_locks_list_at_subscription_level_request, build_management_locks_list_by_scope_request, ) +from .._configuration import ManagementLockClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -70,10 +69,10 @@ class AuthorizationOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -165,10 +164,10 @@ class ManagementLocksOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -437,7 +436,6 @@ async def create_or_update_by_scope( content_type: str = "application/json", **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -468,7 +466,6 @@ async def create_or_update_by_scope( content_type: str = "application/json", **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -493,7 +490,6 @@ async def create_or_update_by_scope( async def create_or_update_by_scope( self, scope: str, lock_name: str, parameters: Union[_models.ManagementLockObject, IO[bytes]], **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -1516,7 +1512,6 @@ async def get_next(next_link=None): def list_by_scope( self, scope: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.ManagementLockObject"]: - # pylint: disable=line-too-long """Gets all the management locks for a scope. :param scope: The scope for the lock. When providing a scope for the assignment, use diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py index 1933e25607a4..a993d6f80996 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/models/_models_py3.py @@ -107,9 +107,9 @@ def __init__( :paramtype owners: list[~azure.mgmt.resource.locks.v2016_09_01.models.ManagementLockOwner] """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.level = level self.notes = notes self.owners = owners diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py index b67d46ce3160..025d83ed2a98 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/locks/v2016_09_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ManagementLockClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -73,7 +71,7 @@ def build_management_locks_create_or_update_at_resource_group_level_request( # _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -105,7 +103,7 @@ def build_management_locks_delete_at_resource_group_level_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -135,7 +133,7 @@ def build_management_locks_get_at_resource_group_level_request( # pylint: disab _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -254,7 +252,7 @@ def build_management_locks_create_or_update_at_resource_level_request( # pylint _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -297,7 +295,7 @@ def build_management_locks_delete_at_resource_level_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -338,7 +336,7 @@ def build_management_locks_get_at_resource_level_request( # pylint: disable=nam _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks/{lockName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -459,7 +457,7 @@ def build_management_locks_list_at_resource_group_level_request( # pylint: disa _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/locks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -501,7 +499,7 @@ def build_management_locks_list_at_resource_level_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/locks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -596,10 +594,10 @@ class AuthorizationOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -690,10 +688,10 @@ class ManagementLocksOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ManagementLockClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -964,7 +962,6 @@ def create_or_update_by_scope( content_type: str = "application/json", **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -995,7 +992,6 @@ def create_or_update_by_scope( content_type: str = "application/json", **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -1020,7 +1016,6 @@ def create_or_update_by_scope( def create_or_update_by_scope( self, scope: str, lock_name: str, parameters: Union[_models.ManagementLockObject, IO[bytes]], **kwargs: Any ) -> _models.ManagementLockObject: - # pylint: disable=line-too-long """Create or update a management lock by scope. :param scope: The scope for the lock. When providing a scope for the assignment, use @@ -2047,7 +2042,6 @@ def get_next(next_link=None): def list_by_scope( self, scope: str, filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.ManagementLockObject"]: - # pylint: disable=line-too-long """Gets all the management locks for a scope. :param scope: The scope for the lock. When providing a scope for the assignment, use diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py index d56f25094c2f..0b8912954cbe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_application_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -71,13 +73,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ApplicationClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -96,7 +103,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ApplicationClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py index 21d0d4e9d771..ed8ee22cce36 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/aio/_application_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -71,13 +73,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ApplicationClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -96,7 +103,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ApplicationClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_application_client.py index 2a712af1f17a..276e5561117b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_application_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -45,7 +47,7 @@ class ApplicationClient(ApplicationClientOperationsMixin): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -55,13 +57,17 @@ class ApplicationClient(ApplicationClientOperationsMixin): """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ApplicationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -80,7 +86,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_metadata.json index 2220062362ee..dab49ab43cf8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ApplicationClient", "filename": "_application_client", "description": "ARM applications.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ApplicationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ApplicationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ApplicationClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ApplicationClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"ApplicationClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -110,8 +110,8 @@ "jit_requests": "JitRequestsOperations" }, "operation_mixins": { - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"local\": {\".\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"local\": {\"..\": [[\"models\", \"_models\"]]}, \"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}}}", + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Iterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.paging\": [\"ItemPaged\"]}, \"local\": {\".\": [[\"models\", \"_models\"]]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"AsyncIterable\"]}}, \"regular\": {\"sdkcore\": {\"azure.core.async_paging\": [\"AsyncItemPaged\"]}, \"local\": {\"..\": [[\"models\", \"_models\"]]}}}", "sync_mixin_typing_definitions": "", "async_mixin_typing_definitions": "", "operations": { diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/_application_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/_application_client.py index 0ba2c9f628fa..2029e40329b6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/_application_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/_application_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -45,7 +47,7 @@ class ApplicationClient(ApplicationClientOperationsMixin): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -55,13 +57,17 @@ class ApplicationClient(ApplicationClientOperationsMixin): """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = ApplicationClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ApplicationClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -80,7 +86,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/operations/_operations.py index f6ab1c695503..25a03a9f12dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_application_definitions_create_or_update_by_id_request, build_application_definitions_create_or_update_request, @@ -59,12 +61,9 @@ build_jit_requests_list_by_subscription_request, build_jit_requests_update_request, ) +from .._configuration import ApplicationClientConfiguration from .._vendor import ApplicationClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -167,10 +166,10 @@ class ApplicationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -677,7 +676,6 @@ async def update( @distributed_trace def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Application"]: - # pylint: disable=line-too-long """Gets all the applications within a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -758,7 +756,6 @@ async def get_next(next_link=None): @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Application"]: - # pylint: disable=line-too-long """Gets all the applications within a subscription. :return: An iterator like instance of either Application or the result of cls(response) @@ -1418,10 +1415,10 @@ class ApplicationDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1666,7 +1663,6 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1698,7 +1694,6 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1727,7 +1722,6 @@ async def begin_create_or_update( parameters: Union[_models.ApplicationDefinition, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -1796,7 +1790,6 @@ def get_long_running_output(pipeline_response): def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.ApplicationDefinition"]: - # pylint: disable=line-too-long """Lists the managed application definitions in a resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2117,7 +2110,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2149,7 +2141,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2178,7 +2169,6 @@ async def begin_create_or_update_by_id( parameters: Union[_models.ApplicationDefinition, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2258,10 +2248,10 @@ class JitRequestsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -2397,7 +2387,6 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.JitRequestDefinition]: - # pylint: disable=line-too-long """Creates or updates the JIT request. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2428,7 +2417,6 @@ async def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.JitRequestDefinition]: - # pylint: disable=line-too-long """Creates or updates the JIT request. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2456,7 +2444,6 @@ async def begin_create_or_update( parameters: Union[_models.JitRequestDefinition, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.JitRequestDefinition]: - # pylint: disable=line-too-long """Creates or updates the JIT request. :param resource_group_name: The name of the resource group. The name is case insensitive. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/models/_models_py3.py index 2eb0a2958ce1..3a23e041e4b3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Resource(_serialization.Model): @@ -62,9 +57,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -304,18 +299,18 @@ def __init__( # pylint: disable=too-many-locals self.managed_resource_group_id = managed_resource_group_id self.application_definition_id = application_definition_id self.parameters = parameters - self.outputs = None - self.provisioning_state = None - self.billing_details = None + self.outputs: Optional[JSON] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.billing_details: Optional["_models.ApplicationBillingDetailsDefinition"] = None self.jit_access_policy = jit_access_policy - self.publisher_tenant_id = None - self.authorizations = None - self.management_mode = None - self.customer_support = None - self.support_urls = None - self.artifacts = None - self.created_by = None - self.updated_by = None + self.publisher_tenant_id: Optional[str] = None + self.authorizations: Optional[List["_models.ApplicationAuthorization"]] = None + self.management_mode: Optional[Union[str, "_models.ApplicationManagementMode"]] = None + self.customer_support: Optional["_models.ApplicationPackageContact"] = None + self.support_urls: Optional["_models.ApplicationPackageSupportUrls"] = None + self.artifacts: Optional[List["_models.ApplicationArtifact"]] = None + self.created_by: Optional["_models.ApplicationClientDetails"] = None + self.updated_by: Optional["_models.ApplicationClientDetails"] = None class ApplicationArtifact(_serialization.Model): @@ -1222,18 +1217,18 @@ def __init__( # pylint: disable=too-many-locals self.managed_resource_group_id = managed_resource_group_id self.application_definition_id = application_definition_id self.parameters = parameters - self.outputs = None - self.provisioning_state = None - self.billing_details = None + self.outputs: Optional[JSON] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.billing_details: Optional["_models.ApplicationBillingDetailsDefinition"] = None self.jit_access_policy = jit_access_policy - self.publisher_tenant_id = None - self.authorizations = None - self.management_mode = None - self.customer_support = None - self.support_urls = None - self.artifacts = None - self.created_by = None - self.updated_by = None + self.publisher_tenant_id: Optional[str] = None + self.authorizations: Optional[List["_models.ApplicationAuthorization"]] = None + self.management_mode: Optional[Union[str, "_models.ApplicationManagementMode"]] = None + self.customer_support: Optional["_models.ApplicationPackageContact"] = None + self.support_urls: Optional["_models.ApplicationPackageSupportUrls"] = None + self.artifacts: Optional[List["_models.ApplicationArtifact"]] = None + self.created_by: Optional["_models.ApplicationClientDetails"] = None + self.updated_by: Optional["_models.ApplicationClientDetails"] = None class ApplicationPolicy(_serialization.Model): @@ -1331,8 +1326,8 @@ def __init__( self.managed_resource_group_id = managed_resource_group_id self.application_definition_id = application_definition_id self.parameters = parameters - self.outputs = None - self.provisioning_state = None + self.outputs: Optional[JSON] = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None class ErrorAdditionalInfo(_serialization.Model): @@ -1359,8 +1354,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -1400,11 +1395,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -1443,7 +1438,7 @@ class Identity(_serialization.Model): ~azure.mgmt.resource.managedapplications.v2019_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.managedapplications.v2019_07_01.models.UserAssignedResourceIdentity] """ @@ -1474,13 +1469,13 @@ def __init__( ~azure.mgmt.resource.managedapplications.v2019_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.managedapplications.v2019_07_01.models.UserAssignedResourceIdentity] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1665,13 +1660,13 @@ def __init__( """ super().__init__(location=location, tags=tags, **kwargs) self.application_resource_id = application_resource_id - self.publisher_tenant_id = None + self.publisher_tenant_id: Optional[str] = None self.jit_authorization_policies = jit_authorization_policies self.jit_scheduling_policy = jit_scheduling_policy - self.provisioning_state = None - self.jit_request_state = None - self.created_by = None - self.updated_by = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.jit_request_state: Optional[Union[str, "_models.JitRequestState"]] = None + self.created_by: Optional["_models.ApplicationClientDetails"] = None + self.updated_by: Optional["_models.ApplicationClientDetails"] = None class JitRequestDefinitionListResult(_serialization.Model): @@ -1765,7 +1760,7 @@ def __init__(self, *, duration: datetime.timedelta, start_time: datetime.datetim :paramtype start_time: ~datetime.datetime """ super().__init__(**kwargs) - self.type = None + self.type: Optional[Union[str, "_models.JitSchedulingType"]] = None self.duration = duration self.start_time = start_time @@ -1815,11 +1810,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw ~azure.mgmt.resource.managedapplications.v2019_07_01.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationAutoGenerated(_serialization.Model): @@ -1892,10 +1887,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationDisplayAutoGenerated(_serialization.Model): @@ -1962,8 +1957,8 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class Plan(_serialization.Model): @@ -2172,5 +2167,5 @@ class UserAssignedResourceIdentity(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/operations/_operations.py index 0ed431191e20..a0173e214c07 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/managedapplications/v2019_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ApplicationClientConfiguration from .._vendor import ApplicationClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -77,7 +75,7 @@ def build_applications_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -110,7 +108,7 @@ def build_applications_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -144,7 +142,7 @@ def build_applications_create_or_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -180,7 +178,7 @@ def build_applications_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -215,7 +213,7 @@ def build_applications_list_by_resource_group_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -377,7 +375,7 @@ def build_applications_refresh_permissions_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applications/{applicationName}/refreshPermissions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -410,7 +408,7 @@ def build_application_definitions_get_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -445,7 +443,7 @@ def build_application_definitions_delete_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -481,7 +479,7 @@ def build_application_definitions_create_or_update_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -518,7 +516,7 @@ def build_application_definitions_list_by_resource_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -550,7 +548,7 @@ def build_application_definitions_get_by_id_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -585,7 +583,7 @@ def build_application_definitions_delete_by_id_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -621,7 +619,7 @@ def build_application_definitions_create_or_update_by_id_request( # pylint: dis _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/applicationDefinitions/{applicationDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -658,7 +656,7 @@ def build_jit_requests_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -692,7 +690,7 @@ def build_jit_requests_create_or_update_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -728,7 +726,7 @@ def build_jit_requests_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -763,7 +761,7 @@ def build_jit_requests_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests/{jitRequestName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -822,7 +820,7 @@ def build_jit_requests_list_by_resource_group_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Solutions/jitRequests", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -939,10 +937,10 @@ class ApplicationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2184,10 +2182,10 @@ class ApplicationDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2432,7 +2430,6 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2464,7 +2461,6 @@ def begin_create_or_update( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2493,7 +2489,6 @@ def begin_create_or_update( parameters: Union[_models.ApplicationDefinition, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2882,7 +2877,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2914,7 +2908,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -2943,7 +2936,6 @@ def begin_create_or_update_by_id( parameters: Union[_models.ApplicationDefinition, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.ApplicationDefinition]: - # pylint: disable=line-too-long """Creates a new managed application definition. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -3023,10 +3015,10 @@ class JitRequestsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ApplicationClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py index c4122e90b7ee..5c1b9772013c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_policy_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -73,13 +75,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = PolicyClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -98,7 +105,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(PolicyClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py index 84053d0de0c0..79f0ab73252f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/aio/_policy_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -73,13 +75,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = PolicyClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -98,7 +105,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(PolicyClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json index 8f901ff16c3f..1e467b6eb90e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py index 194b9f343ee0..0231acf51dcf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-10-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py index 2942b4d5daba..9987a86fc249 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2015-10-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py index 804841bcb245..579283b94589 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -43,11 +45,8 @@ build_policy_definitions_get_request, build_policy_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,10 +65,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -324,7 +323,6 @@ async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _ def list_for_resource_group( self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -418,7 +416,6 @@ def list_for_resource( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -515,7 +512,6 @@ async def get_next(next_link=None): @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -870,10 +866,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1097,7 +1093,6 @@ async def get(self, policy_definition_name: str, **kwargs: Any) -> _models.Polic @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.PolicyDefinition"]: - # pylint: disable=line-too-long """Gets all the policy definitions for a subscription. :param filter: The filter to apply on the operation. Default value is None. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py index ff7da698d192..07c38505639f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class PolicyAssignment(_serialization.Model): @@ -173,7 +168,7 @@ def __init__( :paramtype policy_rule: JSON """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.policy_type = policy_type self.display_name = display_name diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py index 1f8c71259b02..f8fd74c622cb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2015_10_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -446,10 +444,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1247,10 +1245,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json index c3254dc6e52f..321aee133607 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py index 3c7759c8d009..b99a50b3c386 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py index d704fba4ead1..9e194eceeec5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-04-01". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py index e7d317a1f29a..8ee918d2d4ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -43,11 +45,8 @@ build_policy_definitions_get_request, build_policy_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -66,10 +65,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -847,10 +846,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py index 346cf08874d2..2684a364bdff 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class PolicyAssignment(_serialization.Model): @@ -172,7 +167,7 @@ def __init__( :paramtype policy_rule: JSON """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.policy_type = policy_type self.display_name = display_name diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py index 21d6a35cd476..701ac720ef8e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_04_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyassignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policydefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -446,10 +444,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1227,10 +1225,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json index 12eb4fc10984..2f8e45401d82 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py index c352d9894d73..2875ce7badf3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-12-01". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py index ba3bca5a9b0a..c4b96631b1af 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-12-01". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py index 3b210c27dd51..f1c6a18447dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -49,11 +51,8 @@ build_policy_definitions_list_by_management_group_request, build_policy_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,10 +71,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -815,10 +814,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py index a6325a98c910..9992056456f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class PolicyAssignment(_serialization.Model): @@ -88,7 +83,7 @@ def __init__( :paramtype description: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.type = type self.name = name self.display_name = display_name @@ -205,8 +200,8 @@ def __init__( :paramtype parameters: JSON """ super().__init__(**kwargs) - self.id = None - self.name = None + self.id: Optional[str] = None + self.name: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py index 95feda37b38a..b03bc14759c3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2016_12_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +52,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -83,7 +81,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -110,7 +108,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -167,7 +165,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -196,7 +194,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -223,7 +221,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -298,7 +296,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -411,7 +409,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -453,7 +451,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -603,10 +601,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1346,10 +1344,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json index 32ea83bbe6e8..a8e299e77d7a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py index 33d35cd8aab1..dc7197d6017c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-06-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py index d5bb8a7611f7..cfd4d90e58de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-06-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py index 6dc21f7ee466..aace79e48171 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -49,11 +51,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -72,10 +71,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -337,7 +336,6 @@ async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _ def list_for_resource_group( self, resource_group_name: str, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets policy assignments for the resource group. :param resource_group_name: The name of the resource group that contains policy assignments. @@ -432,7 +430,6 @@ def list_for_resource( filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets policy assignments for a resource. :param resource_group_name: The name of the resource group containing the resource. The name is @@ -530,7 +527,6 @@ async def get_next(next_link=None): @distributed_trace def list(self, filter: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.PolicyAssignment"]: - # pylint: disable=line-too-long """Gets all the policy assignments for a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -889,10 +885,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1172,7 +1168,6 @@ async def get_built_in(self, policy_set_definition_name: str, **kwargs: Any) -> @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.PolicySetDefinition"]: - # pylint: disable=line-too-long """Gets all the policy set definitions for a subscription. :return: An iterator like instance of either PolicySetDefinition or the result of cls(response) @@ -1251,7 +1246,6 @@ async def get_next(next_link=None): @distributed_trace def list_built_in(self, **kwargs: Any) -> AsyncIterable["_models.PolicySetDefinition"]: - # pylint: disable=line-too-long """Gets all the built in policy set definitions. :return: An iterator like instance of either PolicySetDefinition or the result of cls(response) @@ -1573,7 +1567,6 @@ async def get_at_management_group( def list_by_management_group( self, management_group_id: str, **kwargs: Any ) -> AsyncIterable["_models.PolicySetDefinition"]: - # pylint: disable=line-too-long """Gets all the policy set definitions for a subscription at management group. :param management_group_id: The ID of the management group. Required. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py index e5cc28c2ffbe..f48eba56cbaa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorResponse(_serialization.Model): @@ -142,9 +137,9 @@ def __init__( :paramtype metadata: JSON """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.display_name = display_name self.policy_definition_id = policy_definition_id @@ -291,9 +286,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2017_06_01_preview.models.PolicyDefinitionReference] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py index 1e8631dbdfd0..d3dbd12da950 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2017_06_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -361,7 +359,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -391,7 +389,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -448,7 +446,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -497,7 +495,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -529,7 +527,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -559,7 +557,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -589,7 +587,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -619,10 +617,10 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1431,10 +1429,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json index 961c6ec13573..4422f1440ace 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py index bb2152b2224e..162c7fde5f02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py index a4a8cef69b9a..f7e4d0b4f53b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-03-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py index 498a63754844..a3b0daeb5e8a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -59,11 +61,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,17 +81,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -166,7 +164,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -202,7 +199,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -236,7 +232,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -315,7 +310,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -981,10 +975,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1759,10 +1753,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py index 5a2651e66211..c236660cb0de 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorResponse(_serialization.Model): @@ -144,9 +139,9 @@ def __init__( :paramtype metadata: JSON """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.display_name = display_name self.policy_definition_id = policy_definition_id @@ -268,9 +263,9 @@ def __init__( :paramtype parameters: JSON """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -415,9 +410,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2018_03_01.models.PolicyDefinitionReference] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py index a6e203ed9728..a9a424285dc4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_03_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -442,7 +440,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -471,7 +469,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -498,7 +496,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -573,7 +571,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -603,7 +601,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -635,7 +633,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -665,7 +663,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -722,7 +720,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -771,7 +769,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -803,7 +801,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -833,7 +831,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -863,7 +861,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -893,15 +891,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -975,7 +972,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1011,7 +1007,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1045,7 +1040,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1124,7 +1118,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1790,10 +1783,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2568,10 +2561,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json index 3082c8e5b7fb..ceac0205a3f6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py index a7fae791ca8a..dc3840bdb820 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py index 9387c4a3a244..354b2da9f5c0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py index 364775f90e2b..c3a94f18f60c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -59,11 +61,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,17 +81,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -166,7 +164,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -202,7 +199,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -236,7 +232,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -315,7 +310,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -981,10 +975,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1759,10 +1753,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py index 77366b69da39..a4da546ed409 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorResponse(_serialization.Model): @@ -91,8 +86,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.policy.v2018_05_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -193,9 +188,9 @@ def __init__( :paramtype metadata: JSON """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.location = location self.identity = identity @@ -319,9 +314,9 @@ def __init__( :paramtype parameters: JSON """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -466,9 +461,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2018_05_01.models.PolicyDefinitionReference] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py index 77308d207fbb..f3478785b569 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -442,7 +440,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -471,7 +469,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -498,7 +496,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -573,7 +571,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -603,7 +601,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -635,7 +633,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -665,7 +663,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -722,7 +720,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -771,7 +769,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -803,7 +801,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -833,7 +831,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -863,7 +861,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -893,15 +891,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -975,7 +972,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1011,7 +1007,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1045,7 +1040,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1124,7 +1118,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1790,10 +1783,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2568,10 +2561,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json index 0b8ca8e0991f..0db81b80a3dd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py index 2d6d97951e02..421dadd29c81 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-01-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py index e66cf5e17dcc..7ef47c054ded 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-01-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py index b94599a26633..d2187c0557e4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -59,11 +61,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,17 +81,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -166,7 +164,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -202,7 +199,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -236,7 +232,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -315,7 +310,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -981,10 +975,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1759,10 +1753,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py index f168d244f51b..47c0095cb065 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorResponse(_serialization.Model): @@ -91,8 +86,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.policy.v2019_01_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -193,9 +188,9 @@ def __init__( :paramtype metadata: JSON """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.location = location self.identity = identity @@ -319,9 +314,9 @@ def __init__( :paramtype parameters: JSON """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -466,9 +461,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2019_01_01.models.PolicyDefinitionReference] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py index 677a64c9c6ca..19d78fa53a1a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_01_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -442,7 +440,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -471,7 +469,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -498,7 +496,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -573,7 +571,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -603,7 +601,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -635,7 +633,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -665,7 +663,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -722,7 +720,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -771,7 +769,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -803,7 +801,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -833,7 +831,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -863,7 +861,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -893,15 +891,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -975,7 +972,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1011,7 +1007,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1045,7 +1040,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1124,7 +1118,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1790,10 +1783,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2568,10 +2561,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json index ed11b866aa1b..4c2b4169b1dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py index 74a9772244fc..8a8ac4a1f9e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py index 4a4fcedf888a..07c0b134042d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py index 6827717e0ecb..02fe4bd47add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -59,11 +61,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -82,17 +81,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -166,7 +164,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -202,7 +199,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -236,7 +232,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -315,7 +310,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -981,10 +975,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1759,10 +1753,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py index d4314d41113c..7fe50e0d73a6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorResponse(_serialization.Model): @@ -91,8 +86,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.policy.v2019_06_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -203,9 +198,9 @@ def __init__( ~azure.mgmt.resource.policy.v2019_06_01.models.EnforcementMode """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.location = location self.identity = identity @@ -330,9 +325,9 @@ def __init__( :paramtype parameters: JSON """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -477,9 +472,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2019_06_01.models.PolicyDefinitionReference] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py index 5dd65ab9b4f9..bab1572601f2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -329,7 +327,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -358,7 +356,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -385,7 +383,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -442,7 +440,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -471,7 +469,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -498,7 +496,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -573,7 +571,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -603,7 +601,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -635,7 +633,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -665,7 +663,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -722,7 +720,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -771,7 +769,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -803,7 +801,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -833,7 +831,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -863,7 +861,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -893,15 +891,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -975,7 +972,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1011,7 +1007,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1045,7 +1040,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1124,7 +1118,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1790,10 +1783,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2568,10 +2561,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json index 2da443c86ddd..e222b60ea282 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py index 49d2ddbf6bee..74286bb6e91e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-09-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py index 7bf24a98ce62..1cb9618afc8f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-09-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py index d2d9da5821fa..5e564b2f922b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -60,11 +62,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -83,17 +82,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -166,7 +164,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -202,7 +199,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -236,7 +232,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -314,7 +309,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1064,10 +1058,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -1842,10 +1836,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py index 3fd299408fbf..519f640c872b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/models/_models_py3.py @@ -6,19 +6,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -45,8 +40,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -87,11 +82,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class Identity(_serialization.Model): @@ -126,8 +121,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.policy.v2019_09_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -355,9 +350,9 @@ def __init__( ~azure.mgmt.resource.policy.v2019_09_01.models.EnforcementMode """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.sku = sku self.location = location self.identity = identity @@ -488,9 +483,9 @@ def __init__( ~azure.mgmt.resource.policy.v2019_09_01.models.ParameterDefinitionsValue] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -741,9 +736,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2019_09_01.models.PolicyDefinitionGroup] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py index 01b8b96ffff7..b09ae3726bf8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_09_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -137,7 +135,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -179,7 +177,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -217,7 +215,7 @@ def build_policy_assignments_list_for_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -359,7 +357,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -391,7 +389,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -421,7 +419,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -478,7 +476,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -510,7 +508,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -540,7 +538,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -615,7 +613,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -645,7 +643,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -677,7 +675,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -707,7 +705,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -764,7 +762,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -813,7 +811,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -845,7 +843,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -875,7 +873,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -905,7 +903,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementgroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -935,15 +933,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -1016,7 +1013,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1052,7 +1048,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1086,7 +1081,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1164,7 +1158,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1914,10 +1907,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2692,10 +2685,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_metadata.json index 16725fb0f2f0..c88223128019 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To exempt your resources from policy evaluation and non-compliance state, you can create an exemption at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_policy_client.py index b61c1aa861b0..ac9f568a520d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/_policy_client.py index cfd5fa3a12be..024afe308ec1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/operations/_operations.py index e83193bd9177..45b8c3a50d82 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_exemptions_create_or_update_request, build_policy_exemptions_delete_request, @@ -36,11 +39,8 @@ build_policy_exemptions_list_for_resource_request, build_policy_exemptions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,15 +59,14 @@ class PolicyExemptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> None: - # pylint: disable=line-too-long """Deletes a policy exemption. This operation deletes a policy exemption, given its name and the scope it was created in. The @@ -136,7 +135,6 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -173,7 +171,6 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -208,7 +205,6 @@ async def create_or_update( parameters: Union[_models.PolicyExemption, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -290,7 +286,6 @@ async def create_or_update( @distributed_trace_async async def get(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Retrieves a policy exemption. This operation retrieves a single policy exemption, given its name and the scope it was created diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/models/_models_py3.py index 7cfe24757068..93974316dc46 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/models/_models_py3.py @@ -6,20 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -46,8 +41,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -88,11 +83,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class PolicyExemption(_serialization.Model): @@ -190,10 +185,10 @@ def __init__( :paramtype metadata: JSON """ super().__init__(**kwargs) - self.system_data = None - self.id = None - self.name = None - self.type = None + self.system_data: Optional["_models.SystemData"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_assignment_id = policy_assignment_id self.policy_definition_reference_ids = policy_definition_reference_ids self.exemption_category = exemption_category @@ -230,7 +225,7 @@ def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, * """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class SystemData(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/operations/_operations.py index ed275e3a266c..82cfd913e40a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_07_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -169,7 +167,7 @@ def build_policy_exemptions_list_for_resource_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -211,7 +209,7 @@ def build_policy_exemptions_list_for_resource_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -249,7 +247,7 @@ def build_policy_exemptions_list_for_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -281,17 +279,16 @@ class PolicyExemptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, scope: str, policy_exemption_name: str, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Deletes a policy exemption. This operation deletes a policy exemption, given its name and the scope it was created in. The @@ -360,7 +357,6 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -397,7 +393,6 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -432,7 +427,6 @@ def create_or_update( parameters: Union[_models.PolicyExemption, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -514,7 +508,6 @@ def create_or_update( @distributed_trace def get(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Retrieves a policy exemption. This operation retrieves a single policy exemption, given its name and the scope it was created diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json index ed95775f650c..0d2adf25ee41 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py index 8a976bd8a4ee..2430efd54f8c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -49,7 +51,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this default value may result in unsupported behavior. @@ -57,13 +59,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -82,7 +88,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py index d79800a18fd4..b4a5fd1439d2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -49,7 +51,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-09-01". Note that overriding this default value may result in unsupported behavior. @@ -57,13 +59,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -82,7 +88,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py index 544e661b896c..928997a5f087 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_data_policy_manifests_get_by_policy_mode_request, build_data_policy_manifests_list_request, @@ -62,11 +64,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,10 +84,10 @@ class DataPolicyManifestsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -244,17 +243,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -327,7 +325,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -363,7 +360,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -397,7 +393,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -475,7 +470,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1270,10 +1264,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2117,10 +2111,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py index 64167b9faf77..d57f0f7389c0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/models/_models_py3.py @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -163,8 +158,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -376,9 +371,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2020_09_01.models.DataManifestCustomResourceFunctionDefinition] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.namespaces = namespaces self.policy_mode = policy_mode self.is_built_in_only = is_built_in_only @@ -445,8 +440,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -487,11 +482,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class Identity(_serialization.Model): @@ -526,8 +521,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.policy.v2020_09_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -819,14 +814,14 @@ def __init__( list[~azure.mgmt.resource.policy.v2020_09_01.models.NonComplianceMessage] """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.location = location self.identity = identity self.display_name = display_name self.policy_definition_id = policy_definition_id - self.scope = None + self.scope: Optional[str] = None self.not_scopes = not_scopes self.parameters = parameters self.description = description @@ -952,9 +947,9 @@ def __init__( ~azure.mgmt.resource.policy.v2020_09_01.models.ParameterDefinitionsValue] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -1205,9 +1200,9 @@ def __init__( list[~azure.mgmt.resource.policy.v2020_09_01.models.PolicyDefinitionGroup] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_type = policy_type self.display_name = display_name self.description = description diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py index cc25deb72383..7553bff780c7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2020_09_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -189,7 +187,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -234,7 +232,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -274,7 +272,7 @@ def build_policy_assignments_list_for_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -421,7 +419,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -453,7 +451,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -483,7 +481,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -540,7 +538,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -572,7 +570,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -602,7 +600,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -689,7 +687,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -723,7 +721,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -755,7 +753,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -785,7 +783,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -842,7 +840,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -901,7 +899,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -933,7 +931,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -963,7 +961,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -993,7 +991,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -1027,10 +1025,10 @@ class DataPolicyManifestsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1186,15 +1184,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -1267,7 +1264,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1303,7 +1299,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1337,7 +1332,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1415,7 +1409,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -2210,10 +2203,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -3059,10 +3052,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json index 74f569173351..2db2409b5bf9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py index f0c2c7e51c56..58e0311cb503 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py index 4a6af43f3c93..2b66edf787cd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -41,7 +43,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this default value may result in unsupported behavior. @@ -49,13 +51,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -74,7 +80,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py index ad71cbb7b9f9..d40c3a033d6a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -62,11 +64,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -85,17 +84,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -168,7 +166,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -204,7 +201,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -238,7 +234,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -316,7 +311,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -386,7 +380,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -422,7 +415,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -456,7 +448,6 @@ async def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -1413,10 +1404,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2260,10 +2251,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py index 5217a9761bdb..d4e0f354793d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -47,8 +42,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -89,11 +84,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class Identity(_serialization.Model): @@ -114,7 +109,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.policy.v2021_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2021_06_01.models.UserAssignedIdentitiesValue] """ @@ -145,13 +140,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.policy.v2021_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2021_06_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -448,15 +443,15 @@ def __init__( list[~azure.mgmt.resource.policy.v2021_06_01.models.NonComplianceMessage] """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.location = location self.identity = identity - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None self.display_name = display_name self.policy_definition_id = policy_definition_id - self.scope = None + self.scope: Optional[str] = None self.not_scopes = not_scopes self.parameters = parameters self.description = description @@ -616,10 +611,10 @@ def __init__( ~azure.mgmt.resource.policy.v2021_06_01.models.ParameterDefinitionsValue] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -874,10 +869,10 @@ def __init__( list[~azure.mgmt.resource.policy.v2021_06_01.models.PolicyDefinitionGroup] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.display_name = display_name self.description = description @@ -1009,5 +1004,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py index 6086c493478d..d0acbd914f4d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2021_06_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -172,7 +170,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -217,7 +215,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -257,7 +255,7 @@ def build_policy_assignments_list_for_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -433,7 +431,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -465,7 +463,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -495,7 +493,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -552,7 +550,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -584,7 +582,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -614,7 +612,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url("policy_definition_name", policy_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -701,7 +699,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -735,7 +733,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -767,7 +765,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -797,7 +795,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -854,7 +852,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -913,7 +911,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -945,7 +943,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -975,7 +973,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url("policy_set_definition_name", policy_set_definition_name, "str"), "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), @@ -1005,7 +1003,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -1039,15 +1037,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -1120,7 +1117,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1156,7 +1152,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1190,7 +1185,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -1268,7 +1262,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -1338,7 +1331,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -1374,7 +1366,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -1408,7 +1399,6 @@ def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -2365,10 +2355,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -3214,10 +3204,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_metadata.json index b30de0916698..51419fa6836d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_policy_client.py index 33b6d4bbdc2c..59a33e046060 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/_policy_client.py index db689d960540..755154f20d2d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-06-01". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/operations/_operations.py index 155e5ef0a4ac..bf3debd75def 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -42,11 +44,8 @@ build_policy_assignments_update_by_id_request, build_policy_assignments_update_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -65,17 +64,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -148,7 +146,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -184,7 +181,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -218,7 +214,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -296,7 +291,6 @@ async def create( @distributed_trace_async async def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -366,7 +360,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -402,7 +395,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -436,7 +428,6 @@ async def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/models/_models_py3.py index 7b46b984a7f1..c17f4f97263d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/models/_models_py3.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -46,8 +42,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -88,11 +84,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class Identity(_serialization.Model): @@ -113,7 +109,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.policy.v2022_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2022_06_01.models.UserAssignedIdentitiesValue] """ @@ -144,13 +140,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.policy.v2022_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2022_06_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -390,15 +386,15 @@ def __init__( :paramtype overrides: list[~azure.mgmt.resource.policy.v2022_06_01.models.Override] """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.location = location self.identity = identity - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None self.display_name = display_name self.policy_definition_id = policy_definition_id - self.scope = None + self.scope: Optional[str] = None self.not_scopes = not_scopes self.parameters = parameters self.description = description @@ -651,5 +647,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/operations/_operations.py index ec38dd7a1dfc..95b818eb2359 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_06_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -172,7 +170,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -217,7 +215,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -257,7 +255,7 @@ def build_policy_assignments_list_for_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -433,15 +431,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -514,7 +511,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -550,7 +546,6 @@ def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -584,7 +579,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -662,7 +656,6 @@ def create( @distributed_trace def get(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -732,7 +725,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -768,7 +760,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -802,7 +793,6 @@ def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_metadata.json index 15e66a920260..0982584a34e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To exempt your resources from policy evaluation and non-compliance state, you can create an exemption at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_policy_client.py index b5eab4d992ce..5d9c65d2e947 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/_policy_client.py index f1178fd9efb0..218c8a24ac75 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -35,7 +37,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -43,13 +45,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +74,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/operations/_operations.py index a506a4f7b9bc..312c9ac2e6f7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_exemptions_create_or_update_request, build_policy_exemptions_delete_request, @@ -37,11 +40,8 @@ build_policy_exemptions_list_request, build_policy_exemptions_update_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,15 +60,14 @@ class PolicyExemptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> None: - # pylint: disable=line-too-long """Deletes a policy exemption. This operation deletes a policy exemption, given its name and the scope it was created in. The @@ -137,7 +136,6 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -174,7 +172,6 @@ async def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -209,7 +206,6 @@ async def create_or_update( parameters: Union[_models.PolicyExemption, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -291,7 +287,6 @@ async def create_or_update( @distributed_trace_async async def get(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Retrieves a policy exemption. This operation retrieves a single policy exemption, given its name and the scope it was created @@ -363,7 +358,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. @@ -397,7 +391,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. @@ -429,7 +422,6 @@ async def update( parameters: Union[_models.PolicyExemptionUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/models/_models_py3.py index 2721e8a41ea9..12afe5ea897e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/models/_models_py3.py @@ -6,20 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -46,8 +41,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -88,11 +83,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class PolicyExemption(_serialization.Model): @@ -209,10 +204,10 @@ def __init__( ~azure.mgmt.resource.policy.v2022_07_01_preview.models.AssignmentScopeValidation """ super().__init__(**kwargs) - self.system_data = None - self.id = None - self.name = None - self.type = None + self.system_data: Optional["_models.SystemData"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.policy_assignment_id = policy_assignment_id self.policy_definition_reference_ids = policy_definition_reference_ids self.exemption_category = exemption_category @@ -251,7 +246,7 @@ def __init__(self, *, value: Optional[List["_models.PolicyExemption"]] = None, * """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class PolicyExemptionUpdate(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/operations/_operations.py index 1ceb65e5e833..0b36dc09861e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_07_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -199,7 +197,7 @@ def build_policy_exemptions_list_for_resource_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -241,7 +239,7 @@ def build_policy_exemptions_list_for_resource_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -279,7 +277,7 @@ def build_policy_exemptions_list_for_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyExemptions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -311,17 +309,16 @@ class PolicyExemptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete( # pylint: disable=inconsistent-return-statements self, scope: str, policy_exemption_name: str, **kwargs: Any ) -> None: - # pylint: disable=line-too-long """Deletes a policy exemption. This operation deletes a policy exemption, given its name and the scope it was created in. The @@ -390,7 +387,6 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -427,7 +423,6 @@ def create_or_update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -462,7 +457,6 @@ def create_or_update( parameters: Union[_models.PolicyExemption, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Creates or updates a policy exemption. This operation creates or updates a policy exemption with the given scope and name. Policy @@ -544,7 +538,6 @@ def create_or_update( @distributed_trace def get(self, scope: str, policy_exemption_name: str, **kwargs: Any) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Retrieves a policy exemption. This operation retrieves a single policy exemption, given its name and the scope it was created @@ -616,7 +609,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. @@ -650,7 +642,6 @@ def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. @@ -682,7 +673,6 @@ def update( parameters: Union[_models.PolicyExemptionUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyExemption: - # pylint: disable=line-too-long """Updates a policy exemption. This operation updates a policy exemption with the given scope and name. diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_metadata.json index c17fcebf96d6..a4cd5bb96b80 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To use in policy authoring you can create a variable at a scope. Variables created at a scope can be shared between multiple policy definitions.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_policy_client.py index a2907e70f353..72c3fd0123a1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/_policy_client.py index 8b7e58091844..b2f636ad542f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -38,7 +40,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-08-01-preview". Note that overriding this default value may result in unsupported behavior. @@ -46,13 +48,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -71,7 +77,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/operations/_operations.py index 3399a6a42121..971fdd44b9c7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/aio/operations/_operations.py @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_variable_values_create_or_update_at_management_group_request, build_variable_values_create_or_update_request, @@ -46,11 +48,8 @@ build_variables_list_for_management_group_request, build_variables_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -69,10 +68,10 @@ class VariablesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -726,10 +725,10 @@ class VariableValuesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/models/_models_py3.py index 335c3144eb3a..cd469430e04b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/models/_models_py3.py @@ -6,20 +6,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -46,8 +41,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -88,11 +83,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class PolicyVariableColumn(_serialization.Model): @@ -268,10 +263,10 @@ def __init__(self, *, columns: List["_models.PolicyVariableColumn"], **kwargs: A list[~azure.mgmt.resource.policy.v2022_08_01_preview.models.PolicyVariableColumn] """ super().__init__(**kwargs) - self.system_data = None - self.id = None - self.name = None - self.type = None + self.system_data: Optional["_models.SystemData"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.columns = columns @@ -302,7 +297,7 @@ def __init__(self, *, value: Optional[List["_models.Variable"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class VariableValue(_serialization.Model): @@ -349,10 +344,10 @@ def __init__(self, *, values: List["_models.PolicyVariableValueColumnValue"], ** list[~azure.mgmt.resource.policy.v2022_08_01_preview.models.PolicyVariableValueColumnValue] """ super().__init__(**kwargs) - self.system_data = None - self.id = None - self.name = None - self.type = None + self.system_data: Optional["_models.SystemData"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.values = values @@ -383,4 +378,4 @@ def __init__(self, *, value: Optional[List["_models.VariableValue"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/operations/_operations.py index 2a8a50b5ff68..43a3776ee27c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2022_08_01_preview/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -50,7 +48,7 @@ def build_variables_delete_request(variable_name: str, subscription_id: str, **k # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -78,7 +76,7 @@ def build_variables_create_or_update_request(variable_name: str, subscription_id # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -107,7 +105,7 @@ def build_variables_get_request(variable_name: str, subscription_id: str, **kwar # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -137,7 +135,7 @@ def build_variables_delete_at_management_group_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -168,7 +166,7 @@ def build_variables_create_or_update_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -200,7 +198,7 @@ def build_variables_get_at_management_group_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -254,7 +252,7 @@ def build_variables_list_for_management_group_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -283,7 +281,7 @@ def build_variable_values_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -315,7 +313,7 @@ def build_variable_values_create_or_update_request( # pylint: disable=name-too- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -348,7 +346,7 @@ def build_variable_values_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -377,7 +375,7 @@ def build_variable_values_list_request(variable_name: str, subscription_id: str, _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/variables/{variableName}/values", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -407,7 +405,7 @@ def build_variable_values_list_for_management_group_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -437,7 +435,7 @@ def build_variable_values_delete_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -469,7 +467,7 @@ def build_variable_values_create_or_update_at_management_group_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -502,7 +500,7 @@ def build_variable_values_get_at_management_group_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/variables/{variableName}/values/{variableValueName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "variableName": _SERIALIZER.url("variable_name", variable_name, "str"), @@ -534,10 +532,10 @@ class VariablesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1191,10 +1189,10 @@ class VariableValuesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_metadata.json index 3bc9bbe81d8a..ee93fb9ebea4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "PolicyClient", "filename": "_policy_client", "description": "To manage and control access to your resources, you can define customized policies and assign them at a scope.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"PolicyClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_policy_client.py index 85553f39d1d0..cc1970fe0436 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class PolicyClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this default value may result in unsupported behavior. @@ -61,13 +63,17 @@ class PolicyClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -86,7 +92,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/_policy_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/_policy_client.py index 85a7d770bb59..7ab573655ce1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/_policy_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/_policy_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class PolicyClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2023-04-01". Note that overriding this default value may result in unsupported behavior. @@ -61,13 +63,17 @@ class PolicyClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = PolicyClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = PolicyClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -86,7 +92,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/operations/_operations.py index 27ec41bb6e3a..eb33da83de01 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -28,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_policy_assignments_create_by_id_request, build_policy_assignments_create_request, @@ -88,11 +90,8 @@ build_policy_set_definitions_list_by_management_group_request, build_policy_set_definitions_list_request, ) +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -111,10 +110,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -958,10 +957,10 @@ class PolicyDefinitionVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1998,10 +1997,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2886,10 +2885,10 @@ class PolicySetDefinitionVersionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3390,7 +3389,6 @@ async def get_built_in( def list( self, policy_set_definition_name: str, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicySetDefinitionVersion"]: - # pylint: disable=line-too-long """Retrieves the policy set definition versions for a given policy set definition in a subscription. @@ -3485,7 +3483,6 @@ async def get_next(next_link=None): def list_built_in( self, policy_set_definition_name: str, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicySetDefinitionVersion"]: - # pylint: disable=line-too-long """Retrieves built-in policy set definition versions. This operation retrieves a list of all the built-in policy set definition versions for the @@ -3872,7 +3869,6 @@ def list_by_management_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.PolicySetDefinitionVersion"]: - # pylint: disable=line-too-long """Retrieves all policy set definition versions for a given policy set definition in a management group. @@ -3981,17 +3977,16 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async async def delete( self, scope: str, policy_assignment_name: str, **kwargs: Any ) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -4064,7 +4059,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -4100,7 +4094,6 @@ async def create( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -4134,7 +4127,6 @@ async def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -4214,7 +4206,6 @@ async def create( async def get( self, scope: str, policy_assignment_name: str, expand: Optional[str] = None, **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -4289,7 +4280,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -4325,7 +4315,6 @@ async def update( content_type: str = "application/json", **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -4359,7 +4348,6 @@ async def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/models/_models_py3.py index 3117b52fcd9f..e6e7dc0ad32c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class ErrorAdditionalInfo(_serialization.Model): @@ -47,8 +42,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -89,11 +84,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class Identity(_serialization.Model): @@ -114,7 +109,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.policy.v2023_04_01.models.ResourceIdentityType :ivar user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2023_04_01.models.UserAssignedIdentitiesValue] """ @@ -145,13 +140,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.policy.v2023_04_01.models.ResourceIdentityType :keyword user_assigned_identities: The user identity associated with the policy. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.policy.v2023_04_01.models.UserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -531,18 +526,18 @@ def __init__( :paramtype overrides: list[~azure.mgmt.resource.policy.v2023_04_01.models.Override] """ super().__init__(**kwargs) - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None self.location = location self.identity = identity - self.system_data = None + self.system_data: Optional["_models.SystemData"] = None self.display_name = display_name self.policy_definition_id = policy_definition_id self.definition_version = definition_version - self.latest_definition_version = None - self.effective_definition_version = None - self.scope = None + self.latest_definition_version: Optional[str] = None + self.effective_definition_version: Optional[str] = None + self.scope: Optional[str] = None self.not_scopes = not_scopes self.parameters = parameters self.description = description @@ -737,10 +732,10 @@ def __init__( :paramtype versions: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -918,8 +913,8 @@ def __init__( super().__init__(**kwargs) self.policy_definition_id = policy_definition_id self.definition_version = definition_version - self.latest_definition_version = None - self.effective_definition_version = None + self.latest_definition_version: Optional[str] = None + self.effective_definition_version: Optional[str] = None self.parameters = parameters self.policy_definition_reference_id = policy_definition_reference_id self.group_names = group_names @@ -1020,10 +1015,10 @@ def __init__( :paramtype version: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.mode = mode self.display_name = display_name @@ -1173,10 +1168,10 @@ def __init__( :paramtype versions: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.display_name = display_name self.description = description @@ -1319,10 +1314,10 @@ def __init__( :paramtype version: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None self.policy_type = policy_type self.display_name = display_name self.description = description @@ -1525,5 +1520,5 @@ class UserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/operations/_operations.py index eb4f0ca3309b..4f7a400bedaf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2023_04_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -27,12 +28,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import PolicyClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -54,7 +52,7 @@ def build_policy_definitions_create_or_update_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -88,7 +86,7 @@ def build_policy_definitions_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -120,7 +118,7 @@ def build_policy_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -181,7 +179,7 @@ def build_policy_definitions_create_or_update_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -215,7 +213,7 @@ def build_policy_definitions_delete_at_management_group_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -247,7 +245,7 @@ def build_policy_definitions_get_at_management_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -336,7 +334,7 @@ def build_policy_definitions_list_by_management_group_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -390,7 +388,7 @@ def build_policy_definition_versions_list_all_at_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/listPolicyDefinitionVersions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -420,7 +418,7 @@ def build_policy_definition_versions_list_all_request( # pylint: disable=name-t # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/listPolicyDefinitionVersions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -450,7 +448,7 @@ def build_policy_definition_versions_create_or_update_request( # pylint: disabl _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -487,7 +485,7 @@ def build_policy_definition_versions_delete_request( # pylint: disable=name-too _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -522,7 +520,7 @@ def build_policy_definition_versions_get_request( # pylint: disable=name-too-lo _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -557,7 +555,7 @@ def build_policy_definition_versions_get_built_in_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policyDefinitionName": _SERIALIZER.url( "policy_definition_name", policy_definition_name, "str", pattern=r"^[^<>*%&:\?.+/]*[^<>*%&:\?.+/ ]+$" @@ -592,7 +590,7 @@ def build_policy_definition_versions_create_or_update_at_management_group_reques _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -631,7 +629,7 @@ def build_policy_definition_versions_delete_at_management_group_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -668,7 +666,7 @@ def build_policy_definition_versions_get_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -705,7 +703,7 @@ def build_policy_definition_versions_list_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policyDefinitionName": _SERIALIZER.url( @@ -771,7 +769,7 @@ def build_policy_definition_versions_list_by_management_group_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policyDefinitions/{policyDefinitionName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -808,7 +806,7 @@ def build_policy_set_definitions_create_or_update_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -845,7 +843,7 @@ def build_policy_set_definitions_delete_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -880,7 +878,7 @@ def build_policy_set_definitions_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -956,7 +954,7 @@ def build_policy_set_definitions_list_request( # pylint: disable=name-too-long # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -1019,7 +1017,7 @@ def build_policy_set_definitions_create_or_update_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1056,7 +1054,7 @@ def build_policy_set_definitions_delete_at_management_group_request( # pylint: _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1091,7 +1089,7 @@ def build_policy_set_definitions_get_at_management_group_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1133,7 +1131,7 @@ def build_policy_set_definitions_list_by_management_group_request( # pylint: di _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policySetDefinitions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -1189,7 +1187,7 @@ def build_policy_set_definition_versions_list_all_at_management_group_request( _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/listPolicySetDefinitionVersions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -1220,7 +1218,7 @@ def build_policy_set_definition_versions_list_all_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/listPolicySetDefinitionVersions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -1250,7 +1248,7 @@ def build_policy_set_definition_versions_create_or_update_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1290,7 +1288,7 @@ def build_policy_set_definition_versions_delete_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1333,7 +1331,7 @@ def build_policy_set_definition_versions_get_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1373,7 +1371,7 @@ def build_policy_set_definition_versions_get_built_in_request( # pylint: disabl _url = kwargs.pop( "template_url", "/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url( "policy_set_definition_name", @@ -1417,7 +1415,7 @@ def build_policy_set_definition_versions_list_request( # pylint: disable=name-t _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "policySetDefinitionName": _SERIALIZER.url( @@ -1455,7 +1453,7 @@ def build_policy_set_definition_versions_list_built_in_request( # pylint: disab # Construct URL _url = kwargs.pop( "template_url", "/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "policySetDefinitionName": _SERIALIZER.url( "policy_set_definition_name", @@ -1494,7 +1492,7 @@ def build_policy_set_definition_versions_create_or_update_at_management_group_re _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -1536,7 +1534,7 @@ def build_policy_set_definition_versions_delete_at_management_group_request( # _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -1581,7 +1579,7 @@ def build_policy_set_definition_versions_get_at_management_group_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions/{policyDefinitionVersion}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -1628,7 +1626,7 @@ def build_policy_set_definition_versions_list_by_management_group_request( # py _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupName}/providers/Microsoft.Authorization/policySetDefinitions/{policySetDefinitionName}/versions", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupName": _SERIALIZER.url( "management_group_name", management_group_name, "str", max_length=90, min_length=1 @@ -1801,7 +1799,7 @@ def build_policy_assignments_list_for_resource_group_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -1849,7 +1847,7 @@ def build_policy_assignments_list_for_resource_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -1896,7 +1894,7 @@ def build_policy_assignments_list_for_management_group_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Authorization/policyAssignments", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "managementGroupId": _SERIALIZER.url("management_group_id", management_group_id, "str"), } @@ -2083,10 +2081,10 @@ class PolicyDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -2932,10 +2930,10 @@ class PolicyDefinitionVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3974,10 +3972,10 @@ class PolicySetDefinitionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -4864,10 +4862,10 @@ class PolicySetDefinitionVersionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5958,15 +5956,14 @@ class PolicyAssignmentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: PolicyClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def delete(self, scope: str, policy_assignment_name: str, **kwargs: Any) -> Optional[_models.PolicyAssignment]: - # pylint: disable=line-too-long """Deletes a policy assignment. This operation deletes a policy assignment, given its name and the scope it was created in. The @@ -6039,7 +6036,6 @@ def create( content_type: str = "application/json", **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -6075,7 +6071,6 @@ def create( content_type: str = "application/json", **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -6109,7 +6104,6 @@ def create( parameters: Union[_models.PolicyAssignment, IO[bytes]], **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Creates or updates a policy assignment. This operation creates or updates a policy assignment with the given scope and name. Policy @@ -6189,7 +6183,6 @@ def create( def get( self, scope: str, policy_assignment_name: str, expand: Optional[str] = None, **kwargs: Any ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Retrieves a policy assignment. This operation retrieves a single policy assignment, given its name and the scope it was @@ -6264,7 +6257,6 @@ def update( content_type: str = "application/json", **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -6300,7 +6292,6 @@ def update( content_type: str = "application/json", **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments @@ -6334,7 +6325,6 @@ def update( parameters: Union[_models.PolicyAssignmentUpdate, IO[bytes]], **kwargs: Any, ) -> _models.PolicyAssignment: - # pylint: disable=line-too-long """Updates a policy assignment. This operation updates a policy assignment with the given scope and name. Policy assignments diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_resource_private_link_client.py index 6cb2dc271e8f..a91252083b81 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_resource_private_link_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ResourcePrivateLinkClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourcePrivateLinkClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ResourcePrivateLinkClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/aio/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/aio/_resource_private_link_client.py index 8ded31f8fde3..94a8d683baa8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/aio/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/aio/_resource_private_link_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -69,13 +71,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ResourcePrivateLinkClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourcePrivateLinkClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -94,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ResourcePrivateLinkClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json index 80593d43fe7d..80aba044f5d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourcePrivateLinkClient", "filename": "_resource_private_link_client", "description": "Provides operations for managing private link resources.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourcePrivateLinkClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourcePrivateLinkClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourcePrivateLinkClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourcePrivateLinkClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py index 15f90e551bfd..0da00f75de9c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_resource_private_link_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -37,7 +39,7 @@ class ResourcePrivateLinkClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-05-01". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class ResourcePrivateLinkClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourcePrivateLinkClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py index b157c32ebaa3..85ce6adc2881 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/_resource_private_link_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -37,7 +39,7 @@ class ResourcePrivateLinkClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-05-01". Note that overriding this default value may result in unsupported behavior. @@ -45,15 +47,17 @@ class ResourcePrivateLinkClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourcePrivateLinkClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -72,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py index 695198583d53..d03cf0082c97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/aio/operations/_operations.py @@ -5,10 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,6 +25,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_private_link_association_delete_request, build_private_link_association_get_request, @@ -35,11 +37,8 @@ build_resource_management_private_link_list_request, build_resource_management_private_link_put_request, ) +from .._configuration import ResourcePrivateLinkClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -58,10 +57,10 @@ class PrivateLinkAssociationOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourcePrivateLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -359,10 +358,10 @@ class ResourceManagementPrivateLinkOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourcePrivateLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py index 8c87c69c2be6..93be1b81d060 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/models/_models_py3.py @@ -38,8 +38,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -80,11 +80,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class PrivateLinkAssociation(_serialization.Model): @@ -126,9 +126,9 @@ def __init__( """ super().__init__(**kwargs) self.properties = properties - self.id = None - self.type = None - self.name = None + self.id: Optional[str] = None + self.type: Optional[str] = None + self.name: Optional[str] = None class PrivateLinkAssociationGetResult(_serialization.Model): @@ -307,9 +307,9 @@ def __init__( """ super().__init__(**kwargs) self.properties = properties - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py index 2c9ddef49d1c..37205a2ccf3a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/privatelinks/v2020_05_01/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,10 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -24,12 +26,9 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourcePrivateLinkClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -51,7 +50,7 @@ def build_private_link_association_put_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Authorization/privateLinkAssociations/{plaId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "plaId": _SERIALIZER.url("pla_id", pla_id, "str"), @@ -83,7 +82,7 @@ def build_private_link_association_get_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Authorization/privateLinkAssociations/{plaId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "plaId": _SERIALIZER.url("pla_id", pla_id, "str"), @@ -113,7 +112,7 @@ def build_private_link_association_delete_request( # pylint: disable=name-too-l _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Authorization/privateLinkAssociations/{plaId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "plaId": _SERIALIZER.url("pla_id", pla_id, "str"), @@ -143,7 +142,7 @@ def build_private_link_association_list_request( # pylint: disable=name-too-lon _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Authorization/privateLinkAssociations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -173,7 +172,7 @@ def build_resource_management_private_link_put_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks/{rmplName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -208,7 +207,7 @@ def build_resource_management_private_link_get_request( # pylint: disable=name- _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks/{rmplName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -241,7 +240,7 @@ def build_resource_management_private_link_delete_request( # pylint: disable=na _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks/{rmplName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -274,7 +273,7 @@ def build_resource_management_private_link_list_request( # pylint: disable=name _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Authorization/resourceManagementPrivateLinks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } @@ -303,7 +302,7 @@ def build_resource_management_private_link_list_by_resource_group_request( # py _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Authorization/resourceManagementPrivateLinks", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( @@ -336,10 +335,10 @@ class PrivateLinkAssociationOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourcePrivateLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload @@ -639,10 +638,10 @@ class ResourceManagementPrivateLinkOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourcePrivateLinkClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @overload diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py index 33af26ecec95..a9729dd9087f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_resource_management_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -56,7 +58,7 @@ class ResourceManagementClient(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 = '2024-11-01' + DEFAULT_API_VERSION = '2025-03-01' _PROFILE_TAG = "azure.mgmt.resource.resources.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -70,13 +72,18 @@ def __init__( credential: "TokenCredential", subscription_id: str, api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourceManagementClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ResourceManagementClient, self).__init__( api_version=api_version, profile=profile @@ -127,6 +134,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2024-07-01: :mod:`v2024_07_01.models` * 2024-11-01: :mod:`v2024_11_01.models` + * 2025-03-01: :mod:`v2025_03_01.models` """ if api_version == '2016-02-01': from .v2016_02_01 import models @@ -182,6 +190,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2024-11-01': from .v2024_11_01 import models return models + elif api_version == '2025-03-01': + from .v2025_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -206,6 +217,7 @@ def deployment_operations(self): * 2022-09-01: :class:`DeploymentOperationsOperations` * 2024-07-01: :class:`DeploymentOperationsOperations` * 2024-11-01: :class:`DeploymentOperationsOperations` + * 2025-03-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -244,6 +256,8 @@ def deployment_operations(self): from .v2024_07_01.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import DeploymentOperationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployment_operations'".format(api_version)) self._config.api_version = api_version @@ -271,6 +285,7 @@ def deployments(self): * 2022-09-01: :class:`DeploymentsOperations` * 2024-07-01: :class:`DeploymentsOperations` * 2024-11-01: :class:`DeploymentsOperations` + * 2025-03-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -309,6 +324,8 @@ def deployments(self): from .v2024_07_01.operations import DeploymentsOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import DeploymentsOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) self._config.api_version = api_version @@ -332,6 +349,7 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2024-07-01: :class:`Operations` * 2024-11-01: :class:`Operations` + * 2025-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': @@ -362,6 +380,8 @@ def operations(self): from .v2024_07_01.operations import Operations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import Operations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -377,6 +397,7 @@ def provider_resource_types(self): * 2022-09-01: :class:`ProviderResourceTypesOperations` * 2024-07-01: :class:`ProviderResourceTypesOperations` * 2024-11-01: :class:`ProviderResourceTypesOperations` + * 2025-03-01: :class:`ProviderResourceTypesOperations` """ api_version = self._get_api_version('provider_resource_types') if api_version == '2020-10-01': @@ -391,6 +412,8 @@ def provider_resource_types(self): from .v2024_07_01.operations import ProviderResourceTypesOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import ProviderResourceTypesOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import ProviderResourceTypesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'provider_resource_types'".format(api_version)) self._config.api_version = api_version @@ -418,6 +441,7 @@ def providers(self): * 2022-09-01: :class:`ProvidersOperations` * 2024-07-01: :class:`ProvidersOperations` * 2024-11-01: :class:`ProvidersOperations` + * 2025-03-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -456,6 +480,8 @@ def providers(self): from .v2024_07_01.operations import ProvidersOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import ProvidersOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import ProvidersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'providers'".format(api_version)) self._config.api_version = api_version @@ -483,6 +509,7 @@ def resource_groups(self): * 2022-09-01: :class:`ResourceGroupsOperations` * 2024-07-01: :class:`ResourceGroupsOperations` * 2024-11-01: :class:`ResourceGroupsOperations` + * 2025-03-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -521,6 +548,8 @@ def resource_groups(self): from .v2024_07_01.operations import ResourceGroupsOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import ResourceGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_groups'".format(api_version)) self._config.api_version = api_version @@ -548,6 +577,7 @@ def resources(self): * 2022-09-01: :class:`ResourcesOperations` * 2024-07-01: :class:`ResourcesOperations` * 2024-11-01: :class:`ResourcesOperations` + * 2025-03-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -586,6 +616,8 @@ def resources(self): from .v2024_07_01.operations import ResourcesOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import ResourcesOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import ResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resources'".format(api_version)) self._config.api_version = api_version @@ -613,6 +645,7 @@ def tags(self): * 2022-09-01: :class:`TagsOperations` * 2024-07-01: :class:`TagsOperations` * 2024-11-01: :class:`TagsOperations` + * 2025-03-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -651,6 +684,8 @@ def tags(self): from .v2024_07_01.operations import TagsOperations as OperationClass elif api_version == '2024-11-01': from .v2024_11_01.operations import TagsOperations as OperationClass + elif api_version == '2025-03-01': + from .v2025_03_01.operations import TagsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tags'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py index a2d343862702..158b423883e2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/aio/_resource_management_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -27,7 +29,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -56,7 +58,7 @@ class ResourceManagementClient(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 = '2024-11-01' + DEFAULT_API_VERSION = '2025-03-01' _PROFILE_TAG = "azure.mgmt.resource.resources.ResourceManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -70,13 +72,18 @@ def __init__( credential: "AsyncTokenCredential", subscription_id: str, api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = ResourceManagementClientConfiguration(credential, subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourceManagementClientConfiguration(credential, subscription_id, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +102,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(ResourceManagementClient, self).__init__( api_version=api_version, profile=profile @@ -127,6 +134,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2022-09-01: :mod:`v2022_09_01.models` * 2024-07-01: :mod:`v2024_07_01.models` * 2024-11-01: :mod:`v2024_11_01.models` + * 2025-03-01: :mod:`v2025_03_01.models` """ if api_version == '2016-02-01': from ..v2016_02_01 import models @@ -182,6 +190,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2024-11-01': from ..v2024_11_01 import models return models + elif api_version == '2025-03-01': + from ..v2025_03_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -206,6 +217,7 @@ def deployment_operations(self): * 2022-09-01: :class:`DeploymentOperationsOperations` * 2024-07-01: :class:`DeploymentOperationsOperations` * 2024-11-01: :class:`DeploymentOperationsOperations` + * 2025-03-01: :class:`DeploymentOperationsOperations` """ api_version = self._get_api_version('deployment_operations') if api_version == '2016-02-01': @@ -244,6 +256,8 @@ def deployment_operations(self): from ..v2024_07_01.aio.operations import DeploymentOperationsOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import DeploymentOperationsOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import DeploymentOperationsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployment_operations'".format(api_version)) self._config.api_version = api_version @@ -271,6 +285,7 @@ def deployments(self): * 2022-09-01: :class:`DeploymentsOperations` * 2024-07-01: :class:`DeploymentsOperations` * 2024-11-01: :class:`DeploymentsOperations` + * 2025-03-01: :class:`DeploymentsOperations` """ api_version = self._get_api_version('deployments') if api_version == '2016-02-01': @@ -309,6 +324,8 @@ def deployments(self): from ..v2024_07_01.aio.operations import DeploymentsOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import DeploymentsOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import DeploymentsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'deployments'".format(api_version)) self._config.api_version = api_version @@ -332,6 +349,7 @@ def operations(self): * 2022-09-01: :class:`Operations` * 2024-07-01: :class:`Operations` * 2024-11-01: :class:`Operations` + * 2025-03-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2018-05-01': @@ -362,6 +380,8 @@ def operations(self): from ..v2024_07_01.aio.operations import Operations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import Operations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version @@ -377,6 +397,7 @@ def provider_resource_types(self): * 2022-09-01: :class:`ProviderResourceTypesOperations` * 2024-07-01: :class:`ProviderResourceTypesOperations` * 2024-11-01: :class:`ProviderResourceTypesOperations` + * 2025-03-01: :class:`ProviderResourceTypesOperations` """ api_version = self._get_api_version('provider_resource_types') if api_version == '2020-10-01': @@ -391,6 +412,8 @@ def provider_resource_types(self): from ..v2024_07_01.aio.operations import ProviderResourceTypesOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import ProviderResourceTypesOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import ProviderResourceTypesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'provider_resource_types'".format(api_version)) self._config.api_version = api_version @@ -418,6 +441,7 @@ def providers(self): * 2022-09-01: :class:`ProvidersOperations` * 2024-07-01: :class:`ProvidersOperations` * 2024-11-01: :class:`ProvidersOperations` + * 2025-03-01: :class:`ProvidersOperations` """ api_version = self._get_api_version('providers') if api_version == '2016-02-01': @@ -456,6 +480,8 @@ def providers(self): from ..v2024_07_01.aio.operations import ProvidersOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import ProvidersOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import ProvidersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'providers'".format(api_version)) self._config.api_version = api_version @@ -483,6 +509,7 @@ def resource_groups(self): * 2022-09-01: :class:`ResourceGroupsOperations` * 2024-07-01: :class:`ResourceGroupsOperations` * 2024-11-01: :class:`ResourceGroupsOperations` + * 2025-03-01: :class:`ResourceGroupsOperations` """ api_version = self._get_api_version('resource_groups') if api_version == '2016-02-01': @@ -521,6 +548,8 @@ def resource_groups(self): from ..v2024_07_01.aio.operations import ResourceGroupsOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import ResourceGroupsOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import ResourceGroupsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resource_groups'".format(api_version)) self._config.api_version = api_version @@ -548,6 +577,7 @@ def resources(self): * 2022-09-01: :class:`ResourcesOperations` * 2024-07-01: :class:`ResourcesOperations` * 2024-11-01: :class:`ResourcesOperations` + * 2025-03-01: :class:`ResourcesOperations` """ api_version = self._get_api_version('resources') if api_version == '2016-02-01': @@ -586,6 +616,8 @@ def resources(self): from ..v2024_07_01.aio.operations import ResourcesOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import ResourcesOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import ResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'resources'".format(api_version)) self._config.api_version = api_version @@ -613,6 +645,7 @@ def tags(self): * 2022-09-01: :class:`TagsOperations` * 2024-07-01: :class:`TagsOperations` * 2024-11-01: :class:`TagsOperations` + * 2025-03-01: :class:`TagsOperations` """ api_version = self._get_api_version('tags') if api_version == '2016-02-01': @@ -651,6 +684,8 @@ def tags(self): from ..v2024_07_01.aio.operations import TagsOperations as OperationClass elif api_version == '2024-11-01': from ..v2024_11_01.aio.operations import TagsOperations as OperationClass + elif api_version == '2025-03-01': + from ..v2025_03_01.aio.operations import TagsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'tags'".format(api_version)) self._config.api_version = api_version diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py index 9571b83d434a..c292b56f3669 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2024_11_01.models import * +from .v2025_03_01.models import * diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json index b4ae0d0c5a4d..fa266bf26c87 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "ResourceManagementClient.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py index ffd9d06eff8c..b6ae24feae85 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-02-01". Note that overriding this default value may result in unsupported behavior. @@ -63,15 +65,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -90,7 +94,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py index 47ceadc0a788..ebe07f744da9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-02-01". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py index 96500502a37f..7225396b84cf 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_request, build_deployment_operations_list_request, @@ -69,12 +71,9 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -93,10 +92,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -898,10 +897,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1162,10 +1161,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1177,7 +1176,6 @@ def list_resources( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all of the resources under a subscription. :param resource_group_name: Query parameters. If null is passed returns all resource groups. @@ -1908,10 +1906,10 @@ class ResourcesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _move_resources_initial( @@ -2086,7 +2084,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all of the resources under a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -2812,10 +2809,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3110,10 +3107,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py index 5fc45a79fb93..f2854846e9c3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/models/_models_py3.py @@ -7,20 +7,15 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping import datetime -import sys from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -260,7 +255,7 @@ def __init__( ~azure.mgmt.resource.resources.v2016_02_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties @@ -647,7 +642,7 @@ def __init__( self.parameters_link = parameters_link self.mode = mode self.debug_setting = debug_setting - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -710,8 +705,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -752,11 +747,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -830,9 +825,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1032,9 +1027,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1126,8 +1121,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -1395,7 +1390,7 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties self.location = location @@ -1514,7 +1509,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1837,7 +1832,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2016_02_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -1908,7 +1903,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2016_02_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py index 912ad7b87f96..633e98209b4e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +53,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -82,7 +80,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -113,7 +111,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -148,7 +146,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -178,7 +176,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -209,7 +207,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -244,7 +242,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -282,7 +280,7 @@ def build_deployments_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -693,7 +691,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -772,7 +770,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -809,7 +807,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -850,7 +848,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -896,7 +894,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -941,7 +939,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1093,7 +1091,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1127,7 +1125,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,10 +1161,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -1968,10 +1966,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2230,10 +2228,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2975,10 +2973,10 @@ class ResourcesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _move_resources_initial( @@ -3878,10 +3876,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4178,10 +4176,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json index c3bcdad6b95b..266b44cd684f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py index 6a9d7abfa7fb..78a48327b93b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -63,15 +65,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -90,7 +94,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py index c2e21cd6ae14..4ca344a334e3 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-09-01". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py index 2ee1ac3252e8..0da7e6532fa0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_request, build_deployment_operations_list_request, @@ -74,12 +76,9 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -98,10 +97,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -928,10 +927,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1196,10 +1195,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1211,7 +1210,6 @@ def list_resources( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -1944,10 +1942,10 @@ class ResourcesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _move_resources_initial( @@ -2137,7 +2135,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -2982,7 +2979,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3079,7 +3075,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3200,7 +3195,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3232,7 +3226,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3258,7 +3251,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3392,7 +3384,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3424,7 +3415,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3450,7 +3440,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3517,7 +3506,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3585,10 +3573,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3889,10 +3877,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py index 019dc4d7dcc4..213c88376eaa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/models/_models_py3.py @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -275,7 +270,7 @@ def __init__( ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties @@ -327,7 +322,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -362,8 +357,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2016_09_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -415,14 +410,14 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[Any] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -452,7 +447,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -646,9 +641,9 @@ def __init__( :paramtype debug_setting: ~azure.mgmt.resource.resources.v2016_09_01.models.DebugSetting """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -658,7 +653,7 @@ def __init__( self.parameters_link = parameters_link self.mode = mode self.debug_setting = debug_setting - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -721,8 +716,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -763,11 +758,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -841,9 +836,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1045,9 +1040,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1139,8 +1134,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -1257,10 +1252,10 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1290,7 +1285,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1414,7 +1409,7 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties self.location = location @@ -1509,7 +1504,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupProperties(_serialization.Model): @@ -1532,7 +1527,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1563,7 +1558,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1599,10 +1594,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -1837,7 +1832,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2016_09_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -1870,7 +1865,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -1906,7 +1901,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2016_09_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py index 550f54e01384..384af1671ed6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_09_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +53,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -84,7 +82,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -117,7 +115,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -154,7 +152,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -186,7 +184,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -219,7 +217,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -256,7 +254,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -296,7 +294,7 @@ def build_deployments_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -707,7 +705,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -786,7 +784,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -823,7 +821,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -864,7 +862,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -910,7 +908,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -955,7 +953,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1220,7 +1218,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1256,7 +1254,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1294,10 +1292,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -2124,10 +2122,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2390,10 +2388,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3137,10 +3135,10 @@ class ResourcesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _move_resources_initial( @@ -4174,7 +4172,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4271,7 +4268,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4392,7 +4388,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4424,7 +4419,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4450,7 +4444,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4584,7 +4577,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4616,7 +4608,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4642,7 +4633,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4709,7 +4699,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4777,10 +4766,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5083,10 +5072,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json index a0799226f8b4..506ef8618274 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py index 5b1f8d9708b9..21403a5aa95f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-05-10". Note that overriding this default value may result in unsupported behavior. @@ -63,15 +65,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -90,7 +94,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py index dfcea1ba87bc..cfed3343f790 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2017-05-10". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py index 71d70190da61..2dd7fe743dc5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_request, build_deployment_operations_list_request, @@ -75,12 +77,9 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,10 +98,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -929,10 +928,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1197,10 +1196,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1212,7 +1211,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -1678,7 +1676,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -2523,7 +2520,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2620,7 +2616,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2741,7 +2736,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2773,7 +2767,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2799,7 +2792,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2933,7 +2925,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2965,7 +2956,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2991,7 +2981,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3058,7 +3047,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3126,10 +3114,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3776,10 +3764,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4080,10 +4068,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py index 40a4e38cc620..1494c128aa27 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/models/_models_py3.py @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -275,7 +270,7 @@ def __init__( ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties @@ -327,7 +322,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -362,8 +357,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2017_05_10.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -415,14 +410,14 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[Any] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -452,7 +447,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -646,9 +641,9 @@ def __init__( :paramtype debug_setting: ~azure.mgmt.resource.resources.v2017_05_10.models.DebugSetting """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -658,7 +653,7 @@ def __init__( self.parameters_link = parameters_link self.mode = mode self.debug_setting = debug_setting - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -721,8 +716,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -763,11 +758,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -841,9 +836,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1045,9 +1040,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1139,8 +1134,8 @@ def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs :paramtype type: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -1264,10 +1259,10 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1297,7 +1292,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1421,7 +1416,7 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties self.location = location @@ -1516,7 +1511,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1586,7 +1581,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1617,7 +1612,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1653,10 +1648,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -1891,7 +1886,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2017_05_10.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -1924,7 +1919,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -1960,7 +1955,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2017_05_10.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py index ea917d48d1b0..f027a99e1b66 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2017_05_10/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +53,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -84,7 +82,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -117,7 +115,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -154,7 +152,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -186,7 +184,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -219,7 +217,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -256,7 +254,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -296,7 +294,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -510,7 +508,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -546,7 +544,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -625,7 +623,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -662,7 +660,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -703,7 +701,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -749,7 +747,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -794,7 +792,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1256,7 +1254,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1292,7 +1290,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1330,10 +1328,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -2160,10 +2158,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2426,10 +2424,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3750,7 +3748,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3847,7 +3844,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3968,7 +3964,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4000,7 +3995,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4026,7 +4020,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4160,7 +4153,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4192,7 +4184,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4218,7 +4209,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4285,7 +4275,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4353,10 +4342,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5003,10 +4992,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5309,10 +5298,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json index 2e1fc42ec628..87900d4d176f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py index 1b916a267e40..d3815d82abec 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -53,7 +55,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-02-01". Note that overriding this default value may result in unsupported behavior. @@ -63,15 +65,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -90,7 +94,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py index 81b55872ec8e..a5b4f34d3d9e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -55,7 +57,7 @@ class ResourceManagementClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-02-01". Note that overriding this default value may result in unsupported behavior. @@ -65,15 +67,17 @@ class ResourceManagementClient: """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +96,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py index 693c2a1ec2e1..95cfce7d2dbd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_request, build_deployment_operations_list_request, @@ -75,12 +77,9 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -99,10 +98,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_initial( @@ -929,10 +928,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1197,10 +1196,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1212,7 +1211,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -1678,7 +1676,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation. Default value is None. @@ -2521,7 +2518,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2618,7 +2614,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2739,7 +2734,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2771,7 +2765,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2797,7 +2790,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2931,7 +2923,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2963,7 +2954,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -2989,7 +2979,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3056,7 +3045,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3124,10 +3112,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -3774,10 +3762,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4078,10 +4066,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py index 54293d999923..a97997b3cf02 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/models/_models_py3.py @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -275,7 +270,7 @@ def __init__( ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties @@ -327,7 +322,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -362,8 +357,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2018_02_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -415,14 +410,14 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -452,7 +447,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -663,9 +658,9 @@ def __init__( ~azure.mgmt.resource.resources.v2018_02_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -676,7 +671,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -739,8 +734,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -781,11 +776,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -859,9 +854,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1063,9 +1058,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1159,8 +1154,8 @@ def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] :paramtype type: str or ~azure.mgmt.resource.resources.v2018_02_01.models.ResourceIdentityType """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type @@ -1237,7 +1232,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1362,10 +1357,10 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1395,7 +1390,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1519,7 +1514,7 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.name = name self.properties = properties self.location = location @@ -1614,7 +1609,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1684,7 +1679,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1715,7 +1710,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1751,10 +1746,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -1989,7 +1984,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2018_02_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2022,7 +2017,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2058,7 +2053,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2018_02_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py index bd4817cd866b..5ed82227e0fe 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_02_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,13 +32,10 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -55,7 +53,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -84,7 +82,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -117,7 +115,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -154,7 +152,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -186,7 +184,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -219,7 +217,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -256,7 +254,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -296,7 +294,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -510,7 +508,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -546,7 +544,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -625,7 +623,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -662,7 +660,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -703,7 +701,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -749,7 +747,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -794,7 +792,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1256,7 +1254,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1292,7 +1290,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1330,10 +1328,10 @@ class DeploymentsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -2160,10 +2158,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2426,10 +2424,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3748,7 +3746,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3845,7 +3842,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3966,7 +3962,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3998,7 +3993,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4024,7 +4018,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4158,7 +4151,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4190,7 +4182,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4216,7 +4207,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4283,7 +4273,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4351,10 +4340,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5001,10 +4990,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5307,10 +5296,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json index dd6f2265ef57..4c2995ed86ff 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py index 01407832dc36..e0fb9eb8355a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py index 23765007756b..eef6fec9484d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-05-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py index cfe5befbe439..8a859a425201 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_subscription_scope_request, build_deployment_operations_get_request, @@ -86,14 +88,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -110,10 +109,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -205,10 +204,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -1715,10 +1714,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1983,10 +1982,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1998,7 +1997,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -2478,7 +2476,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -3337,7 +3334,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3434,7 +3430,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3555,7 +3550,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3587,7 +3581,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3613,7 +3606,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3747,7 +3739,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3779,7 +3770,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3805,7 +3795,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3872,7 +3861,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3940,10 +3928,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4598,10 +4586,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4902,10 +4890,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py index 536b5d5610cb..a5873083f4b5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2018_05_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -464,14 +459,14 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -501,7 +496,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -712,9 +707,9 @@ def __init__( ~azure.mgmt.resource.resources.v2018_05_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -725,7 +720,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -788,8 +783,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -830,11 +825,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -908,9 +903,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1112,9 +1107,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1190,9 +1185,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2018_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2018_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1225,13 +1220,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2018_05_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2018_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2018_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1309,7 +1304,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1537,10 +1532,10 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1570,7 +1565,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1696,9 +1691,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1792,7 +1787,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1862,7 +1857,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1893,7 +1888,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1929,10 +1924,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2167,7 +2162,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2018_05_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2200,7 +2195,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2236,7 +2231,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2018_05_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py index 27453adff733..5e174266d89d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2018_05_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -73,7 +71,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -98,7 +96,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -127,7 +125,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -160,7 +158,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -189,7 +187,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -219,7 +217,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -253,7 +251,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -312,7 +310,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -341,7 +339,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -374,7 +372,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -411,7 +409,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -443,7 +441,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -476,7 +474,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -513,7 +511,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -553,7 +551,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -767,7 +765,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -803,7 +801,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -882,7 +880,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -919,7 +917,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -960,7 +958,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1006,7 +1004,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1051,7 +1049,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1513,7 +1511,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1580,7 +1578,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1616,7 +1614,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1654,10 +1652,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1749,10 +1747,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -3261,10 +3259,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3527,10 +3525,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4879,7 +4877,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4976,7 +4973,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5097,7 +5093,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5129,7 +5124,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5155,7 +5149,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5289,7 +5282,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5321,7 +5313,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5347,7 +5338,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5414,7 +5404,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5482,10 +5471,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6140,10 +6129,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6446,10 +6435,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json index 5bd43fd75b22..88b1a1f3c21e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py index 4b589eb6b235..75e9f8454ec0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py index f63e8abd1d48..d54d47f2b2eb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-03-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py index 69a0b2ba5371..f5b5e4c2baf4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_subscription_scope_request, build_deployment_operations_get_request, @@ -86,14 +88,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -110,10 +109,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -205,10 +204,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -1715,10 +1714,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -1983,10 +1982,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1998,7 +1997,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -2478,7 +2476,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -3337,7 +3334,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3434,7 +3430,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3555,7 +3550,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3587,7 +3581,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3613,7 +3606,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3747,7 +3739,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3779,7 +3770,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3805,7 +3795,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3872,7 +3861,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -3940,10 +3928,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4598,10 +4586,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4902,10 +4890,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py index b735941a50fc..0a0e5a60ba59 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_03_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -464,14 +459,14 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -501,7 +496,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -712,9 +707,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_03_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -725,7 +720,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -788,8 +783,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -830,11 +825,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -908,9 +903,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1112,9 +1107,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1190,9 +1185,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1225,13 +1220,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_03_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_03_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1309,7 +1304,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1541,11 +1536,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1575,7 +1570,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1708,9 +1703,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1804,7 +1799,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1874,7 +1869,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1905,7 +1900,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1941,10 +1936,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2179,7 +2174,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_03_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2212,7 +2207,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2248,7 +2243,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_03_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py index be17f6ebdb55..25353e29a75e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_03_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -73,7 +71,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -98,7 +96,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -127,7 +125,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -160,7 +158,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -189,7 +187,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -219,7 +217,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -253,7 +251,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -312,7 +310,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -341,7 +339,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -374,7 +372,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -411,7 +409,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -443,7 +441,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -476,7 +474,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -513,7 +511,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -553,7 +551,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -767,7 +765,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -803,7 +801,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -882,7 +880,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -919,7 +917,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -960,7 +958,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1006,7 +1004,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1051,7 +1049,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1513,7 +1511,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1580,7 +1578,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1616,7 +1614,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1654,10 +1652,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -1749,10 +1747,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -3261,10 +3259,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3527,10 +3525,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4879,7 +4877,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4976,7 +4973,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5097,7 +5093,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5129,7 +5124,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5155,7 +5149,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5289,7 +5282,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5321,7 +5313,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5347,7 +5338,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5414,7 +5404,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -5482,10 +5471,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6140,10 +6129,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6446,10 +6435,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json index d7c076608dac..9fbdb6602a14 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py index bc234d8c9e1d..5f5217300bfb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-05-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py index 9f0f4e0c0cd4..607e3dca7089 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-05-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py index e3af0d7b1bbf..b2d78e953366 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_subscription_scope_request, @@ -96,14 +98,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -120,10 +119,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -215,10 +214,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long @@ -2453,10 +2452,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -2721,10 +2720,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2736,7 +2735,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -3216,7 +3214,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -4075,7 +4072,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4172,7 +4168,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4293,7 +4288,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4325,7 +4319,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4351,7 +4344,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4485,7 +4477,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4517,7 +4508,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4543,7 +4533,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4610,7 +4599,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4678,10 +4666,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5336,10 +5324,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5640,10 +5628,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py index 078515dcb1f9..fb51c5623751 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_05_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -468,15 +463,15 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -506,7 +501,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -721,10 +716,10 @@ def __init__( ~azure.mgmt.resource.resources.v2019_05_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -735,7 +730,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -798,8 +793,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -840,11 +835,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -918,9 +913,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1122,9 +1117,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1200,9 +1195,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1235,13 +1230,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_05_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_05_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1319,7 +1314,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1551,11 +1546,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1585,7 +1580,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1718,9 +1713,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1814,7 +1809,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1884,7 +1879,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1915,7 +1910,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1951,10 +1946,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2189,7 +2184,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_05_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2222,7 +2217,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2258,7 +2253,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_05_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py index 8577d18cea5d..20adfd33eb03 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -74,7 +72,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -100,7 +98,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -130,7 +128,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -164,7 +162,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -193,7 +191,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -223,7 +221,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -257,7 +255,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -289,7 +287,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -318,7 +316,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -343,7 +341,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -372,7 +370,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -405,7 +403,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -434,7 +432,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -464,7 +462,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -498,7 +496,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -557,7 +555,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -586,7 +584,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -619,7 +617,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -656,7 +654,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -688,7 +686,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -721,7 +719,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -758,7 +756,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -798,7 +796,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1012,7 +1010,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1048,7 +1046,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1127,7 +1125,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1164,7 +1162,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1205,7 +1203,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1251,7 +1249,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1296,7 +1294,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1758,7 +1756,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -1791,7 +1789,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -1825,7 +1823,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1858,7 +1856,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1892,7 +1890,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1928,7 +1926,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1966,10 +1964,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2061,10 +2059,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long @@ -4303,10 +4301,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4569,10 +4567,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5921,7 +5919,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6018,7 +6015,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6139,7 +6135,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6171,7 +6166,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6197,7 +6191,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6331,7 +6324,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6363,7 +6355,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6389,7 +6380,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6456,7 +6446,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6524,10 +6513,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7182,10 +7171,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7488,10 +7477,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json index 45d77ac15a30..0026bb6663f0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py index afb0cd591069..0d55e88d0e6d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-05-10". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py index b58092794907..2a22b71deb62 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-05-10". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py index 1acbd8121828..8d4e977b83dc 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_subscription_scope_request, @@ -98,14 +100,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -122,10 +121,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -217,10 +216,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long @@ -2455,10 +2454,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -2864,10 +2863,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2879,7 +2878,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -3359,7 +3357,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -4218,7 +4215,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4315,7 +4311,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4436,7 +4431,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4468,7 +4462,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4494,7 +4487,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4628,7 +4620,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4660,7 +4651,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4686,7 +4676,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4753,7 +4742,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -4821,10 +4809,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5479,10 +5467,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5783,10 +5771,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py index 34d3019b5486..a80302b6f168 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_05_10.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -468,15 +463,15 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -506,7 +501,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -721,10 +716,10 @@ def __init__( ~azure.mgmt.resource.resources.v2019_05_10.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -735,7 +730,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -798,8 +793,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -840,11 +835,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -918,9 +913,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1122,9 +1117,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1200,9 +1195,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_05_10.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_05_10.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1235,13 +1230,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_05_10.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_05_10.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_05_10.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1319,7 +1314,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1551,11 +1546,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1585,7 +1580,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1718,9 +1713,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1814,7 +1809,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -1884,7 +1879,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -1915,7 +1910,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceManagementErrorWithDetails(_serialization.Model): @@ -1951,10 +1946,10 @@ class ResourceManagementErrorWithDetails(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ResourceManagementErrorWithDetails"]] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2189,7 +2184,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_05_10.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2222,7 +2217,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2258,7 +2253,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_05_10.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py index 4573f9909169..72d23b04eb9b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_05_10/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -74,7 +72,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -100,7 +98,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -130,7 +128,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -164,7 +162,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -193,7 +191,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -223,7 +221,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -257,7 +255,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -289,7 +287,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -318,7 +316,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -343,7 +341,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -372,7 +370,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -405,7 +403,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -434,7 +432,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -464,7 +462,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -498,7 +496,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -557,7 +555,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -586,7 +584,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -619,7 +617,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -656,7 +654,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -688,7 +686,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -721,7 +719,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -758,7 +756,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -798,7 +796,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1065,7 +1063,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1101,7 +1099,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1180,7 +1178,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1217,7 +1215,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1258,7 +1256,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1304,7 +1302,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1349,7 +1347,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1811,7 +1809,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -1844,7 +1842,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -1878,7 +1876,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1911,7 +1909,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1945,7 +1943,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1981,7 +1979,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2019,10 +2017,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2114,10 +2112,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long @@ -4356,10 +4354,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4763,10 +4761,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -6115,7 +6113,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6212,7 +6209,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6333,7 +6329,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6365,7 +6360,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6391,7 +6385,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6525,7 +6518,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6557,7 +6549,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6583,7 +6574,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6650,7 +6640,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6718,10 +6707,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7376,10 +7365,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7682,10 +7671,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json index ce4c9da1e8ba..df353429cf7d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py index 77ff940a0823..5cc7012d4f31 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py index 14ec32a35d8b..76fc277f9629 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-07-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py index 082b38127ba9..f9aaa0e07e6c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -120,14 +122,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -144,10 +143,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -239,10 +238,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4255,10 +4254,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4664,10 +4663,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4679,7 +4678,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5159,7 +5157,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -6018,7 +6015,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6115,7 +6111,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6236,7 +6231,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6268,7 +6262,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6294,7 +6287,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6428,7 +6420,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6460,7 +6451,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6486,7 +6476,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6553,7 +6542,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6621,10 +6609,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -7279,10 +7267,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -7583,10 +7571,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py index 328b324655df..a4a009cfe93b 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_07_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -468,15 +463,15 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -506,7 +501,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -721,10 +716,10 @@ def __init__( ~azure.mgmt.resource.resources.v2019_07_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -735,7 +730,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -972,8 +967,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1014,11 +1009,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1092,9 +1087,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1296,9 +1291,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1374,9 +1369,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_07_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_07_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1409,13 +1404,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_07_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_07_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1493,7 +1488,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1725,11 +1720,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1759,7 +1754,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1892,9 +1887,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1982,7 +1977,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2052,7 +2047,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2083,7 +2078,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2318,7 +2313,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_07_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2351,7 +2346,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2387,7 +2382,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_07_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py index 11847e639fa4..8536442aac98 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -543,7 +541,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -575,7 +573,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -608,7 +606,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -642,7 +640,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -674,7 +672,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -707,7 +705,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -741,7 +739,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -805,7 +803,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -836,7 +834,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -868,7 +866,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -901,7 +899,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -933,7 +931,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -966,7 +964,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1001,7 +999,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1035,7 +1033,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1097,7 +1095,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1132,7 +1130,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1168,7 +1166,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1205,7 +1203,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1240,7 +1238,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1276,7 +1274,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1314,7 +1312,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1351,7 +1349,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1391,7 +1389,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1660,7 +1658,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1699,7 +1697,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1782,7 +1780,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1825,7 +1823,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1869,7 +1867,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1915,7 +1913,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1960,7 +1958,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2457,7 +2455,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str"), "deploymentName": _SERIALIZER.url( @@ -2582,7 +2580,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2615,7 +2613,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2649,7 +2647,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2682,7 +2680,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2716,7 +2714,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2752,7 +2750,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2790,10 +2788,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2885,10 +2883,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -6907,10 +6905,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7314,10 +7312,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8666,7 +8664,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8763,7 +8760,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8884,7 +8880,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8916,7 +8911,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8942,7 +8936,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9076,7 +9069,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9108,7 +9100,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9134,7 +9125,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9201,7 +9191,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9269,10 +9258,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9927,10 +9916,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10233,10 +10222,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json index 0da41e7080d2..cbdc884e9d87 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py index 0f3342fe35be..fd905773c5b0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-08-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py index 3b043490858e..0983c38ab1b5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-08-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py index 8325aafcc46f..76d6375e04ce 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -120,14 +122,11 @@ build_tags_delete_value_request, build_tags_list_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -144,10 +143,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -239,10 +238,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4259,10 +4258,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -4668,10 +4667,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -4683,7 +4682,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5164,7 +5162,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -6024,7 +6021,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6121,7 +6117,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6242,7 +6237,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6274,7 +6268,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6300,7 +6293,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6434,7 +6426,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6466,7 +6457,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6492,7 +6482,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6559,7 +6548,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6627,10 +6615,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -7350,10 +7338,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -7654,10 +7642,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py index a4a4a2eb331a..695657633a97 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class AliasPathType(_serialization.Model): @@ -141,8 +136,8 @@ class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalp def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class DebugSetting(_serialization.Model): @@ -322,9 +317,9 @@ def __init__( ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties @@ -376,7 +371,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -411,8 +406,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_08_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -468,15 +463,15 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -506,7 +501,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -721,10 +716,10 @@ def __init__( ~azure.mgmt.resource.resources.v2019_08_01.models.OnErrorDeploymentExtended """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None self.outputs = outputs self.providers = providers self.dependencies = dependencies @@ -735,7 +730,7 @@ def __init__( self.mode = mode self.debug_setting = debug_setting self.on_error_deployment = on_error_deployment - self.error = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -972,8 +967,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1014,11 +1009,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1092,9 +1087,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1296,9 +1291,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1374,9 +1369,9 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_08_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_08_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ _validation = { @@ -1409,13 +1404,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_08_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.resource.resources.v2019_08_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] # pylint: disable=line-too-long + ~azure.mgmt.resource.resources.v2019_08_01.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1493,7 +1488,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1725,11 +1720,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1759,7 +1754,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1892,9 +1887,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -1982,7 +1977,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2052,7 +2047,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2083,7 +2078,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2351,7 +2346,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_08_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2384,7 +2379,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagValue(_serialization.Model): @@ -2420,7 +2415,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_08_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py index 96d1655eb58b..40c23c2b4f7d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_08_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -543,7 +541,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -575,7 +573,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -608,7 +606,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -642,7 +640,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -674,7 +672,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -707,7 +705,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -741,7 +739,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -805,7 +803,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -836,7 +834,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -868,7 +866,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -901,7 +899,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -933,7 +931,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -966,7 +964,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1001,7 +999,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1035,7 +1033,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1097,7 +1095,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1132,7 +1130,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1168,7 +1166,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1205,7 +1203,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1240,7 +1238,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1276,7 +1274,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1314,7 +1312,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1351,7 +1349,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1391,7 +1389,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1660,7 +1658,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1699,7 +1697,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1782,7 +1780,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1825,7 +1823,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1869,7 +1867,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1915,7 +1913,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1960,7 +1958,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2457,7 +2455,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str"), "deploymentName": _SERIALIZER.url( @@ -2582,7 +2580,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2615,7 +2613,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2649,7 +2647,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2682,7 +2680,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2716,7 +2714,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2752,7 +2750,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2790,10 +2788,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2885,10 +2883,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -6911,10 +6909,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -7318,10 +7316,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8672,7 +8670,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8769,7 +8766,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8890,7 +8886,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8922,7 +8917,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -8948,7 +8942,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9082,7 +9075,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9114,7 +9106,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9140,7 +9131,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9207,7 +9197,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9275,10 +9264,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9998,10 +9987,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10304,10 +10293,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json index 8881c41a14b7..831821d57b37 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py index 836099cf5b4b..7b7df97388ee 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-10-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py index c6990c3cf2b5..2d20c7fcb0e7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-10-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py index 9ddb0e43abe5..aebb872606f0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -126,14 +128,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -150,10 +149,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -245,10 +244,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4953,10 +4952,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5362,10 +5361,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5377,7 +5376,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5858,7 +5856,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -6718,7 +6715,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6815,7 +6811,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6936,7 +6931,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6968,7 +6962,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6994,7 +6987,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7128,7 +7120,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7160,7 +7151,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7186,7 +7176,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7253,7 +7242,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7321,10 +7309,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8044,10 +8032,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8703,10 +8691,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py index 1e4379ce3016..a506d71b084e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -387,9 +382,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -442,7 +437,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -477,8 +472,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -541,16 +536,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional[JSON] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -580,7 +575,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -774,23 +769,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[str] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -821,7 +816,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2019_10_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1025,8 +1020,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1067,11 +1062,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1145,9 +1140,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1349,9 +1344,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1427,7 +1422,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2019_10_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1457,13 +1452,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2019_10_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2019_10_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1492,8 +1487,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class OnErrorDeployment(_serialization.Model): @@ -1569,7 +1564,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1801,11 +1796,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1835,7 +1830,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -1968,9 +1963,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2058,7 +2053,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2128,7 +2123,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2159,7 +2154,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2235,7 +2230,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -2498,7 +2493,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2019_10_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2551,7 +2546,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -2626,9 +2621,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2019_10_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -2665,7 +2660,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2019_10_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py index 1331d5095a89..895b5ab71c52 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2019_10_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1726,7 +1724,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1765,7 +1763,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1848,7 +1846,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1891,7 +1889,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1935,7 +1933,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1981,7 +1979,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2026,7 +2024,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2627,7 +2625,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2752,7 +2750,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2785,7 +2783,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2819,7 +2817,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2852,7 +2850,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2886,7 +2884,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2922,7 +2920,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2960,10 +2958,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3055,10 +3053,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7769,10 +7767,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8176,10 +8174,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9530,7 +9528,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9627,7 +9624,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9748,7 +9744,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9780,7 +9775,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9806,7 +9800,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9940,7 +9933,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9972,7 +9964,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9998,7 +9989,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10065,7 +10055,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10133,10 +10122,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10856,10 +10845,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11517,10 +11506,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json index 584cf4151509..fd15b84aad3a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py index e0852b460ad3..281586d1f7e1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -56,7 +58,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-06-01". Note that overriding this default value may result in unsupported behavior. @@ -66,15 +68,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -93,7 +97,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py index 492f657774a8..187eb3e23795 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -58,7 +60,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-06-01". Note that overriding this default value may result in unsupported behavior. @@ -68,15 +70,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,7 +99,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py index bcbc6ec26f7c..5a955d9c515a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -127,14 +129,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -151,10 +150,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -246,10 +245,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4954,10 +4953,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5415,10 +5414,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5430,7 +5429,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5911,7 +5909,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -6771,7 +6768,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6868,7 +6864,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6989,7 +6984,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7021,7 +7015,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7047,7 +7040,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7181,7 +7173,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7213,7 +7204,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7239,7 +7229,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7306,7 +7295,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7374,10 +7362,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8108,10 +8096,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8767,10 +8755,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py index 5950c2557514..f290ec20d52d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -468,9 +463,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -523,7 +518,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -558,8 +553,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -624,16 +619,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -663,7 +658,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -873,23 +868,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -920,7 +915,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2020_06_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1137,8 +1132,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1179,11 +1174,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1284,9 +1279,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1486,9 +1481,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1564,7 +1559,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2020_06_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1594,13 +1589,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2020_06_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2020_06_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1629,8 +1624,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class OnErrorDeployment(_serialization.Model): @@ -1706,7 +1701,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1938,11 +1933,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderListResult(_serialization.Model): @@ -1972,7 +1967,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -2050,9 +2045,9 @@ def __init__( self.locations = locations self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2120,9 +2115,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2210,7 +2205,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2280,7 +2275,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2311,7 +2306,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2387,7 +2382,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -2678,7 +2673,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2020_06_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2731,7 +2726,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -2806,9 +2801,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2020_06_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -2845,7 +2840,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2020_06_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py index 94655116bb4b..48b31f834fd7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_06_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -544,7 +542,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -574,7 +572,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -605,7 +603,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -637,7 +635,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -667,7 +665,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -698,7 +696,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -731,7 +729,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -763,7 +761,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -793,7 +791,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -825,7 +823,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -854,7 +852,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -884,7 +882,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -915,7 +913,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -945,7 +943,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -976,7 +974,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1009,7 +1007,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1041,7 +1039,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1101,7 +1099,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1134,7 +1132,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1168,7 +1166,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1203,7 +1201,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1236,7 +1234,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1270,7 +1268,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1306,7 +1304,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1341,7 +1339,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1379,7 +1377,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1468,7 +1466,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1678,7 +1676,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", source_resource_group_name, "str", max_length=90, min_length=1 @@ -1712,7 +1710,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", source_resource_group_name, "str", max_length=90, min_length=1 @@ -1790,7 +1788,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1833,7 +1831,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1877,7 +1875,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1923,7 +1921,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1968,7 +1966,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2573,7 +2571,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2690,7 +2688,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2721,7 +2719,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2753,7 +2751,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), @@ -2784,7 +2782,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2816,7 +2814,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2850,7 +2848,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2886,10 +2884,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -2981,10 +2979,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7695,10 +7693,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8154,10 +8152,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9508,7 +9506,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9605,7 +9602,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9726,7 +9722,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9758,7 +9753,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9784,7 +9778,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9918,7 +9911,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9950,7 +9942,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9976,7 +9967,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10043,7 +10033,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10111,10 +10100,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10845,10 +10834,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11506,10 +11495,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json index 4fe8de53e716..333a294b769a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py index aa45172c6559..9b08752024d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py index 217e49a6aa27..278d51a6fcc5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2020-10-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py index 92e12a5d430c..5405136d0c4a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -128,14 +130,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -152,10 +151,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -247,10 +246,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4955,10 +4954,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5416,10 +5415,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5494,10 +5493,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5509,7 +5508,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5987,7 +5985,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation. The properties you can use for eq (equals) @@ -6844,7 +6841,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6941,7 +6937,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7062,7 +7057,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7094,7 +7088,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7120,7 +7113,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7254,7 +7246,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7286,7 +7277,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7312,7 +7302,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7379,7 +7368,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7447,10 +7435,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8170,10 +8158,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8829,10 +8817,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py index 6f38544620d1..d80db3699947 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -468,9 +463,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -523,7 +518,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -558,8 +553,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -624,16 +619,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -663,7 +658,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -873,23 +868,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -920,7 +915,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2020_10_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1137,8 +1132,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1179,11 +1174,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1284,9 +1279,9 @@ def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, s :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.tags = tags @@ -1486,9 +1481,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1564,7 +1559,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2020_10_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1594,13 +1589,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2020_10_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2020_10_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1629,8 +1624,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class OnErrorDeployment(_serialization.Model): @@ -1706,7 +1701,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -1938,11 +1933,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderExtendedLocation(_serialization.Model): @@ -2011,7 +2006,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -2098,9 +2093,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2132,7 +2127,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2198,9 +2193,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2288,7 +2283,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2358,7 +2353,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2389,7 +2384,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2465,7 +2460,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -2756,7 +2751,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2020_10_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2809,7 +2804,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -2884,9 +2879,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2020_10_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -2923,7 +2918,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2020_10_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py index d5cf3873d8f4..0c3f9382e20c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2020_10_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -544,7 +542,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -574,7 +572,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -605,7 +603,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -637,7 +635,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -667,7 +665,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -698,7 +696,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -731,7 +729,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -763,7 +761,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -793,7 +791,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -825,7 +823,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -854,7 +852,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -884,7 +882,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -915,7 +913,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -945,7 +943,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -976,7 +974,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1009,7 +1007,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1041,7 +1039,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1101,7 +1099,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1134,7 +1132,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1168,7 +1166,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1203,7 +1201,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1236,7 +1234,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1270,7 +1268,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1306,7 +1304,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1341,7 +1339,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1379,7 +1377,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1468,7 +1466,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1709,7 +1707,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", source_resource_group_name, "str", max_length=90, min_length=1 @@ -1743,7 +1741,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", source_resource_group_name, "str", max_length=90, min_length=1 @@ -1821,7 +1819,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1864,7 +1862,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1908,7 +1906,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1954,7 +1952,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -1999,7 +1997,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2600,7 +2598,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2717,7 +2715,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2748,7 +2746,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), @@ -2780,7 +2778,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), @@ -2811,7 +2809,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url("deployment_name", deployment_name, "str", max_length=64, min_length=1), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -2843,7 +2841,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2877,7 +2875,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 @@ -2913,10 +2911,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3008,10 +3006,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7722,10 +7720,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8181,10 +8179,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8259,10 +8257,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9607,7 +9605,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9704,7 +9701,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9825,7 +9821,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9857,7 +9852,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9883,7 +9877,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10017,7 +10010,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10049,7 +10041,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10075,7 +10066,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10142,7 +10132,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10210,10 +10199,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -10933,10 +10922,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11594,10 +11583,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json index b3dd7337e057..5a0aa2257c56 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py index 754b9fa3fda2..59ada89778f8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-01-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py index 4ef34ab779cd..09bdd161f050 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-01-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py index 0a6a0f40fc5c..1dac53c9e9f4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -128,14 +130,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -152,10 +151,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -247,10 +246,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4955,10 +4954,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5416,10 +5415,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5494,10 +5493,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5509,7 +5508,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -5990,7 +5988,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The @@ -6850,7 +6847,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -6947,7 +6943,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7068,7 +7063,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7100,7 +7094,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7126,7 +7119,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7260,7 +7252,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7292,7 +7283,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7318,7 +7308,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7385,7 +7374,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7453,10 +7441,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8187,10 +8175,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8846,10 +8834,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py index 56ae4447c837..d867cf438950 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -468,9 +463,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -523,7 +518,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -558,8 +553,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -624,16 +619,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -663,7 +658,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -873,23 +868,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -920,7 +915,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2021_01_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1137,8 +1132,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1179,11 +1174,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1329,9 +1324,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.extended_location = extended_location self.tags = tags @@ -1549,9 +1544,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1627,7 +1622,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2021_01_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1657,13 +1652,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2021_01_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2021_01_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1692,8 +1687,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class OnErrorDeployment(_serialization.Model): @@ -1769,7 +1764,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -2001,11 +1996,11 @@ def __init__(self, *, namespace: Optional[str] = None, **kwargs: Any) -> None: :paramtype namespace: str """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None class ProviderExtendedLocation(_serialization.Model): @@ -2074,7 +2069,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderResourceType(_serialization.Model): @@ -2161,9 +2156,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2195,7 +2190,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2261,9 +2256,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2351,7 +2346,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2421,7 +2416,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2452,7 +2447,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2528,7 +2523,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -2819,7 +2814,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2021_01_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -2872,7 +2867,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -2947,9 +2942,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2021_01_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -2986,7 +2981,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2021_01_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py index bf5a4b2d1a2e..706be0f7a885 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_01_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1787,7 +1785,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1826,7 +1824,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1909,7 +1907,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1952,7 +1950,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1996,7 +1994,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2042,7 +2040,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2087,7 +2085,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2692,7 +2690,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2817,7 +2815,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2850,7 +2848,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2884,7 +2882,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2917,7 +2915,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2951,7 +2949,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2987,7 +2985,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3025,10 +3023,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3120,10 +3118,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7834,10 +7832,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8293,10 +8291,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8371,10 +8369,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9725,7 +9723,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9822,7 +9819,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9943,7 +9939,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -9975,7 +9970,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10001,7 +9995,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10135,7 +10128,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10167,7 +10159,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10193,7 +10184,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10260,7 +10250,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10328,10 +10317,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11062,10 +11051,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11723,10 +11712,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json index e83989a10aa3..6fe2598335d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py index eedf1f0c41ff..87541c9a239f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py index d5b9533d4ade..173c8c936268 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-04-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py index 2e31600c2342..ce42b70e792c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -129,14 +131,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -153,10 +152,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -248,10 +247,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4956,10 +4955,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5533,10 +5532,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5611,10 +5610,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5626,7 +5625,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -6107,7 +6105,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter @@ -6977,7 +6974,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -7077,7 +7073,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7198,7 +7193,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7230,7 +7224,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7256,7 +7249,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7390,7 +7382,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7422,7 +7413,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7448,7 +7438,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7515,7 +7504,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7583,10 +7571,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8317,10 +8305,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8976,10 +8964,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py index 40e4b0749220..ea02583cb6ab 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -468,9 +463,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -523,7 +518,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -558,8 +553,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -624,16 +619,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -663,7 +658,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentProperties(_serialization.Model): @@ -873,23 +868,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -920,7 +915,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2021_04_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1137,8 +1132,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1179,11 +1174,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1329,9 +1324,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.extended_location = extended_location self.tags = tags @@ -1549,9 +1544,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1627,7 +1622,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2021_04_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1657,13 +1652,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2021_04_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2021_04_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1692,8 +1687,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class OnErrorDeployment(_serialization.Model): @@ -1769,7 +1764,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -2062,11 +2057,11 @@ def __init__( ~azure.mgmt.resource.resources.v2021_04_01.models.ProviderAuthorizationConsentState """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None self.provider_authorization_consent_state = provider_authorization_consent_state @@ -2157,7 +2152,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderPermission(_serialization.Model): @@ -2239,7 +2234,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderRegistrationRequest(_serialization.Model): @@ -2350,9 +2345,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2384,7 +2379,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2450,9 +2445,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2540,7 +2535,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2610,7 +2605,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2641,7 +2636,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2717,7 +2712,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -3061,7 +3056,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2021_04_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -3114,7 +3109,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -3189,9 +3184,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2021_04_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -3228,7 +3223,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2021_04_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py index 254f37d2a860..36bee5b31e5d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2021_04_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1575,7 +1573,7 @@ def build_providers_provider_permissions_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1813,7 +1811,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1852,7 +1850,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1935,7 +1933,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1978,7 +1976,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2022,7 +2020,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2068,7 +2066,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2113,7 +2111,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2718,7 +2716,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2843,7 +2841,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2876,7 +2874,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2910,7 +2908,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2943,7 +2941,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2977,7 +2975,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3013,7 +3011,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3051,10 +3049,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3146,10 +3144,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7860,10 +7858,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8435,10 +8433,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8513,10 +8511,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9877,7 +9875,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -9977,7 +9974,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10098,7 +10094,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10130,7 +10125,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10156,7 +10150,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10290,7 +10283,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10322,7 +10314,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10348,7 +10339,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10415,7 +10405,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10483,10 +10472,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11217,10 +11206,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11878,10 +11867,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json index 61adef547e8c..6fade3500cde 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py index f77964164359..046c2fc259a9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py index 9815d611a366..463e6c4b094c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-09-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py index 4b81ae636823..f6b6b38a5d3e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -129,14 +131,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -153,10 +152,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -248,10 +247,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4956,10 +4955,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5533,10 +5532,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5611,10 +5610,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5626,7 +5625,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -6107,7 +6105,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter @@ -6977,7 +6974,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -7077,7 +7073,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7198,7 +7193,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7230,7 +7224,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7256,7 +7249,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7390,7 +7382,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7422,7 +7413,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7448,7 +7438,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7515,7 +7504,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7583,10 +7571,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8317,10 +8305,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -9152,10 +9140,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py index a8059e82839f..8cc505ffe60e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -468,9 +463,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -523,7 +518,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -558,8 +553,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -624,16 +619,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -663,7 +658,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentParameter(_serialization.Model): @@ -909,23 +904,23 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None class DeploymentValidateResult(_serialization.Model): @@ -956,7 +951,7 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2022_09_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None + self.error: Optional["_models.ErrorResponse"] = None self.properties = properties @@ -1175,8 +1170,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1217,11 +1212,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1367,9 +1362,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.extended_location = extended_location self.tags = tags @@ -1587,9 +1582,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1665,7 +1660,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2022_09_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1695,13 +1690,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2022_09_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2022_09_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1730,8 +1725,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class KeyVaultParameterReference(_serialization.Model): @@ -1879,7 +1874,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -2172,11 +2167,11 @@ def __init__( ~azure.mgmt.resource.resources.v2022_09_01.models.ProviderAuthorizationConsentState """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None self.provider_authorization_consent_state = provider_authorization_consent_state @@ -2267,7 +2262,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderPermission(_serialization.Model): @@ -2349,7 +2344,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderRegistrationRequest(_serialization.Model): @@ -2460,9 +2455,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2494,7 +2489,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2560,9 +2555,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2650,7 +2645,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2720,7 +2715,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2751,7 +2746,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2827,7 +2822,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -3171,7 +3166,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2022_09_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -3224,7 +3219,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -3299,9 +3294,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2022_09_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -3338,7 +3333,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2022_09_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py index 0507f216567a..d3fb5e4edd73 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2022_09_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1575,7 +1573,7 @@ def build_providers_provider_permissions_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1813,7 +1811,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1852,7 +1850,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1935,7 +1933,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1978,7 +1976,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2022,7 +2020,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2068,7 +2066,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2113,7 +2111,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2718,7 +2716,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2843,7 +2841,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2876,7 +2874,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2910,7 +2908,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2943,7 +2941,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2977,7 +2975,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3013,7 +3011,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3051,10 +3049,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3146,10 +3144,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7860,10 +7858,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8435,10 +8433,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8513,10 +8511,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9877,7 +9875,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -9977,7 +9974,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10098,7 +10094,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10130,7 +10125,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10156,7 +10150,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10290,7 +10283,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10322,7 +10314,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10348,7 +10339,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10415,7 +10405,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10483,10 +10472,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11217,10 +11206,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -12054,10 +12043,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_metadata.json index 8f80f24cf057..6608bea0b200 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_resource_management_client.py index 019e5c0b3c92..9a391eda51a7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-07-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/_resource_management_client.py index a588313d2849..4ace02190bcb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-07-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/operations/_operations.py index fb0c523fb856..cba262fbea3c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -129,14 +131,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -153,10 +152,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -248,10 +247,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4956,10 +4955,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5533,10 +5532,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5611,10 +5610,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5626,7 +5625,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -6107,7 +6105,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter @@ -6977,7 +6974,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -7077,7 +7073,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7198,7 +7193,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7230,7 +7224,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7256,7 +7249,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7390,7 +7382,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7422,7 +7413,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7448,7 +7438,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7515,7 +7504,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7583,10 +7571,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8321,10 +8309,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -9156,10 +9144,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/models/_models_py3.py index fc60c2a8f915..7e1a03c37b2a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -435,11 +430,11 @@ class DeploymentDiagnosticsDefinition(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.level = None - self.code = None - self.message = None - self.target = None - self.additional_info = None + self.level: Optional[Union[str, "_models.Level"]] = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class DeploymentExportResult(_serialization.Model): @@ -515,9 +510,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -570,7 +565,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -605,8 +600,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2024_07_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -671,16 +666,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -710,7 +705,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentParameter(_serialization.Model): @@ -961,24 +956,24 @@ class DeploymentPropertiesExtended(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None - self.diagnostics = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None class DeploymentValidateResult(_serialization.Model): @@ -1021,10 +1016,10 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2024_07_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None - self.id = None - self.name = None - self.type = None + self.error: Optional["_models.ErrorResponse"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -1243,8 +1238,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1285,11 +1280,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1452,9 +1447,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.extended_location = extended_location self.tags = tags @@ -1672,9 +1667,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1750,7 +1745,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2024_07_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2024_07_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1780,13 +1775,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2024_07_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2024_07_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1815,8 +1810,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class KeyVaultParameterReference(_serialization.Model): @@ -1964,7 +1959,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -2257,11 +2252,11 @@ def __init__( ~azure.mgmt.resource.resources.v2024_07_01.models.ProviderAuthorizationConsentState """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None self.provider_authorization_consent_state = provider_authorization_consent_state @@ -2352,7 +2347,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderPermission(_serialization.Model): @@ -2434,7 +2429,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderRegistrationRequest(_serialization.Model): @@ -2545,9 +2540,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2579,7 +2574,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2645,9 +2640,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2746,7 +2741,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2816,7 +2811,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2847,7 +2842,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2923,7 +2918,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -3267,7 +3262,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2024_07_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -3320,7 +3315,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -3395,9 +3390,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2024_07_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -3434,7 +3429,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2024_07_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count @@ -3698,7 +3693,7 @@ def __init__( self.error = error self.changes = changes self.potential_changes = potential_changes - self.diagnostics = None + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None class WhatIfPropertyChange(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/operations/_operations.py index a783090f29f1..e11d127671ad 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_07_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1575,7 +1573,7 @@ def build_providers_provider_permissions_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1813,7 +1811,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1852,7 +1850,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1935,7 +1933,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1978,7 +1976,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2022,7 +2020,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2068,7 +2066,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2113,7 +2111,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2718,7 +2716,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2843,7 +2841,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2876,7 +2874,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2910,7 +2908,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2943,7 +2941,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2977,7 +2975,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3013,7 +3011,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3051,10 +3049,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3146,10 +3144,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7860,10 +7858,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8435,10 +8433,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8513,10 +8511,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9877,7 +9875,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -9977,7 +9974,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10098,7 +10094,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10130,7 +10125,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10156,7 +10150,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10290,7 +10283,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10322,7 +10314,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10348,7 +10339,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10415,7 +10405,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10483,10 +10472,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11221,10 +11210,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -12058,10 +12047,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_metadata.json index d4424c2400ed..94ecbb032acd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_metadata.json @@ -5,13 +5,13 @@ "name": "ResourceManagementClient", "filename": "_resource_management_client", "description": "Provides operations for working with resources and resource groups.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -57,7 +57,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -80,7 +80,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_resource_management_client.py index bc08384cb302..bf9b4a14105e 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -60,7 +62,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -70,15 +72,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -97,7 +101,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/_resource_management_client.py index 34866679f717..1b63d9bfec00 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/_resource_management_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/_resource_management_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -62,7 +64,7 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The Microsoft Azure subscription ID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2024-11-01". Note that overriding this default value may result in unsupported behavior. @@ -72,15 +74,17 @@ class ResourceManagementClient: # pylint: disable=too-many-instance-attributes """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) self._config = ResourceManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -99,7 +103,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/operations/_operations.py index 049e22c5fba4..2a3fa8240777 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/aio/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -32,6 +33,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_deployment_operations_get_at_management_group_scope_request, build_deployment_operations_get_at_scope_request, @@ -129,14 +131,11 @@ build_tags_list_request, build_tags_update_at_scope_request, ) +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Operations: @@ -153,10 +152,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -248,10 +247,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: @@ -4956,10 +4955,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5533,10 +5532,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -5611,10 +5610,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -5626,7 +5625,6 @@ def list_by_resource_group( top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources for a resource group. :param resource_group_name: The resource group with the resources to get. Required. @@ -6107,7 +6105,6 @@ def get_long_running_output(pipeline_response): # pylint: disable=inconsistent- def list( self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.GenericResourceExpanded"]: - # pylint: disable=line-too-long """Get all the resources in a subscription. :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter @@ -6977,7 +6974,6 @@ async def get( @distributed_trace_async async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -7077,7 +7073,6 @@ async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwar @distributed_trace_async async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7198,7 +7193,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7230,7 +7224,6 @@ async def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7256,7 +7249,6 @@ async def begin_create_or_update_by_id( async def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7390,7 +7382,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7422,7 +7413,6 @@ async def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7448,7 +7438,6 @@ async def begin_update_by_id( async def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7515,7 +7504,6 @@ def get_long_running_output(pipeline_response): @distributed_trace_async async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -7583,10 +7571,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -8321,10 +8309,10 @@ class TagsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async @@ -9156,10 +9144,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace_async diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/models/_models_py3.py index 24781e6c428e..529b386992b4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/models/_models_py3.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,19 +7,14 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys +from collections.abc import MutableMapping from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from ... import _serialization -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - if TYPE_CHECKING: from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] class Alias(_serialization.Model): @@ -84,7 +79,7 @@ def __init__( self.type = type self.default_path = default_path self.default_pattern = default_pattern - self.default_metadata = None + self.default_metadata: Optional["_models.AliasPathMetadata"] = None class AliasPath(_serialization.Model): @@ -134,7 +129,7 @@ def __init__( self.path = path self.api_versions = api_versions self.pattern = pattern - self.metadata = None + self.metadata: Optional["_models.AliasPathMetadata"] = None class AliasPathMetadata(_serialization.Model): @@ -164,8 +159,8 @@ class AliasPathMetadata(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.attributes = None + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None class AliasPattern(_serialization.Model): @@ -231,8 +226,8 @@ class ApiProfile(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.profile_version = None - self.api_version = None + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None class BasicDependency(_serialization.Model): @@ -435,11 +430,11 @@ class DeploymentDiagnosticsDefinition(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.level = None - self.code = None - self.message = None - self.target = None - self.additional_info = None + self.level: Optional[Union[str, "_models.Level"]] = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class DeploymentExportResult(_serialization.Model): @@ -515,9 +510,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.properties = properties self.tags = tags @@ -570,7 +565,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentOperation(_serialization.Model): @@ -605,8 +600,8 @@ def __init__(self, *, properties: Optional["_models.DeploymentOperationPropertie ~azure.mgmt.resource.resources.v2024_11_01.models.DeploymentOperationProperties """ super().__init__(**kwargs) - self.id = None - self.operation_id = None + self.id: Optional[str] = None + self.operation_id: Optional[str] = None self.properties = properties @@ -671,16 +666,16 @@ class DeploymentOperationProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_operation = None - self.provisioning_state = None - self.timestamp = None - self.duration = None - self.service_request_id = None - self.status_code = None - self.status_message = None - self.target_resource = None - self.request = None - self.response = None + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None class DeploymentOperationsListResult(_serialization.Model): @@ -710,7 +705,7 @@ def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = Non """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class DeploymentParameter(_serialization.Model): @@ -984,24 +979,24 @@ def __init__( ~azure.mgmt.resource.resources.v2024_11_01.models.ValidationLevel """ super().__init__(**kwargs) - self.provisioning_state = None - self.correlation_id = None - self.timestamp = None - self.duration = None - self.outputs = None - self.providers = None - self.dependencies = None - self.template_link = None - self.parameters = None - self.parameters_link = None - self.mode = None - self.debug_setting = None - self.on_error_deployment = None - self.template_hash = None - self.output_resources = None - self.validated_resources = None - self.error = None - self.diagnostics = None + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None self.validation_level = validation_level @@ -1045,10 +1040,10 @@ def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended ~azure.mgmt.resource.resources.v2024_11_01.models.DeploymentPropertiesExtended """ super().__init__(**kwargs) - self.error = None - self.id = None - self.name = None - self.type = None + self.error: Optional["_models.ErrorResponse"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -1278,8 +1273,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorResponse(_serialization.Model): @@ -1320,11 +1315,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ExportTemplateRequest(_serialization.Model): @@ -1487,9 +1482,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.location = location self.extended_location = extended_location self.tags = tags @@ -1707,9 +1702,9 @@ def __init__( identity=identity, **kwargs ) - self.created_time = None - self.changed_time = None - self.provisioning_state = None + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None class GenericResourceFilter(_serialization.Model): @@ -1785,7 +1780,7 @@ class Identity(_serialization.Model): :vartype type: str or ~azure.mgmt.resource.resources.v2024_11_01.models.ResourceIdentityType :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :vartype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2024_11_01.models.IdentityUserAssignedIdentitiesValue] """ @@ -1815,13 +1810,13 @@ def __init__( :paramtype type: str or ~azure.mgmt.resource.resources.v2024_11_01.models.ResourceIdentityType :keyword user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. :paramtype user_assigned_identities: dict[str, ~azure.mgmt.resource.resources.v2024_11_01.models.IdentityUserAssignedIdentitiesValue] """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None self.type = type self.user_assigned_identities = user_assigned_identities @@ -1850,8 +1845,8 @@ class IdentityUserAssignedIdentitiesValue(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.principal_id = None - self.client_id = None + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None class KeyVaultParameterReference(_serialization.Model): @@ -1999,7 +1994,7 @@ def __init__( :paramtype deployment_name: str """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None self.type = type self.deployment_name = deployment_name @@ -2292,11 +2287,11 @@ def __init__( ~azure.mgmt.resource.resources.v2024_11_01.models.ProviderAuthorizationConsentState """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.namespace = namespace - self.registration_state = None - self.registration_policy = None - self.resource_types = None + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None self.provider_authorization_consent_state = provider_authorization_consent_state @@ -2387,7 +2382,7 @@ def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderPermission(_serialization.Model): @@ -2469,7 +2464,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ProviderRegistrationRequest(_serialization.Model): @@ -2580,9 +2575,9 @@ def __init__( self.location_mappings = location_mappings self.aliases = aliases self.api_versions = api_versions - self.default_api_version = None + self.default_api_version: Optional[str] = None self.zone_mappings = zone_mappings - self.api_profiles = None + self.api_profiles: Optional[List["_models.ApiProfile"]] = None self.capabilities = capabilities self.properties = properties @@ -2614,7 +2609,7 @@ def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = No """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroup(_serialization.Model): @@ -2680,9 +2675,9 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties self.location = location self.managed_by = managed_by @@ -2781,7 +2776,7 @@ def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **k """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceGroupPatchable(_serialization.Model): @@ -2851,7 +2846,7 @@ class ResourceGroupProperties(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provisioning_state = None + self.provisioning_state: Optional[str] = None class ResourceListResult(_serialization.Model): @@ -2882,7 +2877,7 @@ def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long @@ -2958,7 +2953,7 @@ class ResourceReference(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None class ResourcesMoveInfo(_serialization.Model): @@ -3302,7 +3297,7 @@ def __init__( :paramtype values: list[~azure.mgmt.resource.resources.v2024_11_01.models.TagValue] """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_name = tag_name self.count = count self.values = values @@ -3355,7 +3350,7 @@ def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwar """ super().__init__(**kwargs) self.value = value - self.next_link = None + self.next_link: Optional[str] = None class TagsPatchResource(_serialization.Model): @@ -3430,9 +3425,9 @@ def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: :paramtype properties: ~azure.mgmt.resource.resources.v2024_11_01.models.Tags """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.properties = properties @@ -3469,7 +3464,7 @@ def __init__( :paramtype count: ~azure.mgmt.resource.resources.v2024_11_01.models.TagCount """ super().__init__(**kwargs) - self.id = None + self.id: Optional[str] = None self.tag_value = tag_value self.count = count @@ -3610,7 +3605,7 @@ class WhatIfChange(_serialization.Model): All required parameters must be populated in order to send to server. - :ivar resource_id: Resource ID. Required. + :ivar resource_id: Resource ID. :vartype resource_id: str :ivar deployment_id: The resource id of the Deployment responsible for this change. :vartype deployment_id: str @@ -3634,7 +3629,6 @@ class WhatIfChange(_serialization.Model): """ _validation = { - "resource_id": {"required": True}, "change_type": {"required": True}, } @@ -3653,8 +3647,8 @@ class WhatIfChange(_serialization.Model): def __init__( self, *, - resource_id: str, change_type: Union[str, "_models.ChangeType"], + resource_id: Optional[str] = None, deployment_id: Optional[str] = None, symbolic_name: Optional[str] = None, identifiers: Optional[JSON] = None, @@ -3665,7 +3659,7 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword resource_id: Resource ID. Required. + :keyword resource_id: Resource ID. :paramtype resource_id: str :keyword deployment_id: The resource id of the Deployment responsible for this change. :paramtype deployment_id: str @@ -3756,7 +3750,7 @@ def __init__( self.error = error self.changes = changes self.potential_changes = potential_changes - self.diagnostics = None + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None class WhatIfPropertyChange(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py index e2b443b47c6c..e42952dfb255 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2024_11_01/operations/_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -31,15 +32,12 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False @@ -574,7 +572,7 @@ def build_deployments_delete_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -606,7 +604,7 @@ def build_deployments_check_existence_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -639,7 +637,7 @@ def build_deployments_create_or_update_at_management_group_scope_request( # pyl _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -673,7 +671,7 @@ def build_deployments_get_at_management_group_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -705,7 +703,7 @@ def build_deployments_cancel_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -738,7 +736,7 @@ def build_deployments_validate_at_management_group_scope_request( # pylint: dis _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -773,7 +771,7 @@ def build_deployments_what_if_at_management_group_scope_request( # pylint: disa _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -807,7 +805,7 @@ def build_deployments_export_template_at_management_group_scope_request( # pyli _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -839,7 +837,7 @@ def build_deployments_list_at_management_group_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), } @@ -871,7 +869,7 @@ def build_deployments_delete_at_subscription_scope_request( # pylint: disable=n # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -902,7 +900,7 @@ def build_deployments_check_existence_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -934,7 +932,7 @@ def build_deployments_create_or_update_at_subscription_scope_request( # pylint: # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -967,7 +965,7 @@ def build_deployments_get_at_subscription_scope_request( # pylint: disable=name # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -999,7 +997,7 @@ def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=n _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1032,7 +1030,7 @@ def build_deployments_validate_at_subscription_scope_request( # pylint: disable _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1067,7 +1065,7 @@ def build_deployments_what_if_at_subscription_scope_request( # pylint: disable= _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1101,7 +1099,7 @@ def build_deployments_export_template_at_subscription_scope_request( # pylint: _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1163,7 +1161,7 @@ def build_deployments_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1198,7 +1196,7 @@ def build_deployments_check_existence_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1234,7 +1232,7 @@ def build_deployments_create_or_update_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1271,7 +1269,7 @@ def build_deployments_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1306,7 +1304,7 @@ def build_deployments_cancel_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1342,7 +1340,7 @@ def build_deployments_validate_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1380,7 +1378,7 @@ def build_deployments_what_if_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1417,7 +1415,7 @@ def build_deployments_export_template_request( # pylint: disable=name-too-long _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1457,7 +1455,7 @@ def build_deployments_list_by_resource_group_request( # pylint: disable=name-to _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1546,7 +1544,7 @@ def build_providers_register_at_management_group_scope_request( # pylint: disab _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), @@ -1575,7 +1573,7 @@ def build_providers_provider_permissions_request( # pylint: disable=name-too-lo # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -1813,7 +1811,7 @@ def build_resources_move_resources_request( # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1852,7 +1850,7 @@ def build_resources_validate_move_resources_request( # pylint: disable=name-too # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "sourceResourceGroupName": _SERIALIZER.url( "source_resource_group_name", @@ -1935,7 +1933,7 @@ def build_resources_check_existence_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -1978,7 +1976,7 @@ def build_resources_delete_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2022,7 +2020,7 @@ def build_resources_create_or_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2068,7 +2066,7 @@ def build_resources_update_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2113,7 +2111,7 @@ def build_resources_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2718,7 +2716,7 @@ def build_deployment_operations_get_at_scope_request( # pylint: disable=name-to # Construct URL _url = kwargs.pop( "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), "deploymentName": _SERIALIZER.url( @@ -2843,7 +2841,7 @@ def build_deployment_operations_get_at_management_group_scope_request( # pylint _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2876,7 +2874,7 @@ def build_deployment_operations_list_at_management_group_scope_request( # pylin _url = kwargs.pop( "template_url", "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), "deploymentName": _SERIALIZER.url( @@ -2910,7 +2908,7 @@ def build_deployment_operations_get_at_subscription_scope_request( # pylint: di _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2943,7 +2941,7 @@ def build_deployment_operations_list_at_subscription_scope_request( # pylint: d _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "deploymentName": _SERIALIZER.url( "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -2977,7 +2975,7 @@ def build_deployment_operations_get_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3013,7 +3011,7 @@ def build_deployment_operations_list_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" @@ -3051,10 +3049,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -3146,10 +3144,10 @@ class DeploymentsOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: @@ -7860,10 +7858,10 @@ class ProvidersOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8435,10 +8433,10 @@ class ProviderResourceTypesOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -8513,10 +8511,10 @@ class ResourcesOperations: # pylint: disable=too-many-public-methods def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -9877,7 +9875,6 @@ def get( @distributed_trace def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: - # pylint: disable=line-too-long """Checks by ID whether a resource exists. This API currently works only for a limited set of Resource providers. In the event that a Resource provider does not implement this API, ARM will respond with a 405. The alternative then is to use the GET API to check for the existence of @@ -9977,7 +9974,6 @@ def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: An @distributed_trace def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: - # pylint: disable=line-too-long """Deletes a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10098,7 +10094,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10130,7 +10125,6 @@ def begin_create_or_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10156,7 +10150,6 @@ def begin_create_or_update_by_id( def begin_create_or_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Create a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10290,7 +10283,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10322,7 +10314,6 @@ def begin_update_by_id( content_type: str = "application/json", **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10348,7 +10339,6 @@ def begin_update_by_id( def begin_update_by_id( self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.GenericResource]: - # pylint: disable=line-too-long """Updates a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10415,7 +10405,6 @@ def get_long_running_output(pipeline_response): @distributed_trace def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: - # pylint: disable=line-too-long """Gets a resource by ID. :param resource_id: The fully qualified ID of the resource, including the resource name and @@ -10483,10 +10472,10 @@ class ResourceGroupsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -11221,10 +11210,10 @@ class TagsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -12058,10 +12047,10 @@ class DeploymentOperationsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/__init__.py new file mode 100644 index 000000000000..1425a43e3809 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/__init__.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._resource_management_client import ResourceManagementClient # type: ignore +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResourceManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_configuration.py new file mode 100644 index 000000000000..f0c4ebfa9ece --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ResourceManagementClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ResourceManagementClient. + + 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. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2025-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01") + + 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 = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-resource/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**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/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_metadata.json new file mode 100644 index 000000000000..b8dd1e19eb36 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_metadata.json @@ -0,0 +1,117 @@ +{ + "chosen_version": "2025-03-01", + "total_api_version_list": ["2025-03-01"], + "client": { + "name": "ResourceManagementClient", + "filename": "_resource_management_client", + "description": "Provides operations for working with resources and resource groups.", + "host_value": null, + "parameterized_host_template": null, + "azure_arm": true, + "has_public_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"ResourceManagementClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential: \"TokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true, + "method_location": "positional" + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID. Required.", + "docstring_type": "str", + "required": true, + "method_location": "positional" + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure. Required.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The Microsoft Azure subscription ID. Required.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "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, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles=KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + }, + "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, + "method_location": "positional" + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false, + "method_location": "positional" + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false, + "method_location": "positional" + } + } + } + }, + "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\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "deployments": "DeploymentsOperations", + "providers": "ProvidersOperations", + "provider_resource_types": "ProviderResourceTypesOperations", + "resources": "ResourcesOperations", + "resource_groups": "ResourceGroupsOperations", + "tags": "TagsOperations", + "deployment_operations": "DeploymentOperationsOperations" + } +} diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_patch.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_resource_management_client.py new file mode 100644 index 000000000000..335f36edfe67 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_resource_management_client.py @@ -0,0 +1,161 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings +from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from . import models as _models +from .._serialization import Deserializer, Serializer +from ._configuration import ResourceManagementClientConfiguration +from .operations import ( + DeploymentOperationsOperations, + DeploymentsOperations, + Operations, + ProviderResourceTypesOperations, + ProvidersOperations, + ResourceGroupsOperations, + ResourcesOperations, + TagsOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class ResourceManagementClient: # pylint: disable=too-many-instance-attributes + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2025_03_01.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.resource.resources.v2025_03_01.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: azure.mgmt.resource.resources.v2025_03_01.operations.ProvidersOperations + :ivar provider_resource_types: ProviderResourceTypesOperations operations + :vartype provider_resource_types: + azure.mgmt.resource.resources.v2025_03_01.operations.ProviderResourceTypesOperations + :ivar resources: ResourcesOperations operations + :vartype resources: azure.mgmt.resource.resources.v2025_03_01.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: + azure.mgmt.resource.resources.v2025_03_01.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2025_03_01.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: + azure.mgmt.resource.resources.v2025_03_01.operations.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The Microsoft Azure subscription ID. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword api_version: Api Version. Default value is "2025-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourceManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **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, "2025-03-01") + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.provider_resource_types = ProviderResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.tags = TagsOperations(self._client, self._config, self._serialize, self._deserialize, "2025-03-01") + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :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, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/_version.py new file mode 100644 index 000000000000..e13c9711e3d9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_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 = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/__init__.py new file mode 100644 index 000000000000..f06ef4b18a05 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/__init__.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._resource_management_client import ResourceManagementClient # type: ignore + +try: + from ._patch import __all__ as _patch_all + from ._patch import * +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ResourceManagementClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore + +_patch_sdk() diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_configuration.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_configuration.py new file mode 100644 index 000000000000..ac575380d6e9 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_configuration.py @@ -0,0 +1,64 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ResourceManagementClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ResourceManagementClient. + + 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. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. Required. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2025-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01") + + 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 = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-resource/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**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/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_patch.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_resource_management_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_resource_management_client.py new file mode 100644 index 000000000000..e51ea0c95d68 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/_resource_management_client.py @@ -0,0 +1,167 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self + +from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings +from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from ._configuration import ResourceManagementClientConfiguration +from .operations import ( + DeploymentOperationsOperations, + DeploymentsOperations, + Operations, + ProviderResourceTypesOperations, + ProvidersOperations, + ResourceGroupsOperations, + ResourcesOperations, + TagsOperations, +) + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class ResourceManagementClient: # pylint: disable=too-many-instance-attributes + """Provides operations for working with resources and resource groups. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.resource.resources.v2025_03_01.aio.operations.Operations + :ivar deployments: DeploymentsOperations operations + :vartype deployments: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.DeploymentsOperations + :ivar providers: ProvidersOperations operations + :vartype providers: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.ProvidersOperations + :ivar provider_resource_types: ProviderResourceTypesOperations operations + :vartype provider_resource_types: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.ProviderResourceTypesOperations + :ivar resources: ResourcesOperations operations + :vartype resources: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.ResourcesOperations + :ivar resource_groups: ResourceGroupsOperations operations + :vartype resource_groups: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.ResourceGroupsOperations + :ivar tags: TagsOperations operations + :vartype tags: azure.mgmt.resource.resources.v2025_03_01.aio.operations.TagsOperations + :ivar deployment_operations: DeploymentOperationsOperations operations + :vartype deployment_operations: + azure.mgmt.resource.resources.v2025_03_01.aio.operations.DeploymentOperationsOperations + :param credential: Credential needed for the client to connect to Azure. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The Microsoft Azure subscription ID. Required. + :type subscription_id: str + :param base_url: Service URL. Default value is None. + :type base_url: str + :keyword api_version: Api Version. Default value is "2025-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = ResourceManagementClientConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **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, "2025-03-01") + self.deployments = DeploymentsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.providers = ProvidersOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.provider_resource_types = ProviderResourceTypesOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.resources = ResourcesOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.resource_groups = ResourceGroupsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + self.tags = TagsOperations(self._client, self._config, self._serialize, self._deserialize, "2025-03-01") + self.deployment_operations = DeploymentOperationsOperations( + self._client, self._config, self._serialize, self._deserialize, "2025-03-01" + ) + + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **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/dpcodegen/python/send_request + + :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, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/__init__.py new file mode 100644 index 000000000000..fc92299ca9cb --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import DeploymentsOperations # type: ignore +from ._operations import ProvidersOperations # type: ignore +from ._operations import ProviderResourceTypesOperations # type: ignore +from ._operations import ResourcesOperations # type: ignore +from ._operations import ResourceGroupsOperations # type: ignore +from ._operations import TagsOperations # type: ignore +from ._operations import DeploymentOperationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "DeploymentsOperations", + "ProvidersOperations", + "ProviderResourceTypesOperations", + "ResourcesOperations", + "ResourceGroupsOperations", + "TagsOperations", + "DeploymentOperationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_operations.py new file mode 100644 index 000000000000..66f4496b0e4b --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_operations.py @@ -0,0 +1,9860 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import AsyncPipelineClient +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...._serialization import Deserializer, Serializer +from ...operations._operations import ( + build_deployment_operations_get_at_management_group_scope_request, + build_deployment_operations_get_at_scope_request, + build_deployment_operations_get_at_subscription_scope_request, + build_deployment_operations_get_at_tenant_scope_request, + build_deployment_operations_get_request, + build_deployment_operations_list_at_management_group_scope_request, + build_deployment_operations_list_at_scope_request, + build_deployment_operations_list_at_subscription_scope_request, + build_deployment_operations_list_at_tenant_scope_request, + build_deployment_operations_list_request, + build_deployments_calculate_template_hash_request, + build_deployments_cancel_at_management_group_scope_request, + build_deployments_cancel_at_scope_request, + build_deployments_cancel_at_subscription_scope_request, + build_deployments_cancel_at_tenant_scope_request, + build_deployments_cancel_request, + build_deployments_check_existence_at_management_group_scope_request, + build_deployments_check_existence_at_scope_request, + build_deployments_check_existence_at_subscription_scope_request, + build_deployments_check_existence_at_tenant_scope_request, + build_deployments_check_existence_request, + build_deployments_create_or_update_at_management_group_scope_request, + build_deployments_create_or_update_at_scope_request, + build_deployments_create_or_update_at_subscription_scope_request, + build_deployments_create_or_update_at_tenant_scope_request, + build_deployments_create_or_update_request, + build_deployments_delete_at_management_group_scope_request, + build_deployments_delete_at_scope_request, + build_deployments_delete_at_subscription_scope_request, + build_deployments_delete_at_tenant_scope_request, + build_deployments_delete_request, + build_deployments_export_template_at_management_group_scope_request, + build_deployments_export_template_at_scope_request, + build_deployments_export_template_at_subscription_scope_request, + build_deployments_export_template_at_tenant_scope_request, + build_deployments_export_template_request, + build_deployments_get_at_management_group_scope_request, + build_deployments_get_at_scope_request, + build_deployments_get_at_subscription_scope_request, + build_deployments_get_at_tenant_scope_request, + build_deployments_get_request, + build_deployments_list_at_management_group_scope_request, + build_deployments_list_at_scope_request, + build_deployments_list_at_subscription_scope_request, + build_deployments_list_at_tenant_scope_request, + build_deployments_list_by_resource_group_request, + build_deployments_validate_at_management_group_scope_request, + build_deployments_validate_at_scope_request, + build_deployments_validate_at_subscription_scope_request, + build_deployments_validate_at_tenant_scope_request, + build_deployments_validate_request, + build_deployments_what_if_at_management_group_scope_request, + build_deployments_what_if_at_subscription_scope_request, + build_deployments_what_if_at_tenant_scope_request, + build_deployments_what_if_request, + build_operations_list_request, + build_provider_resource_types_list_request, + build_providers_get_at_tenant_scope_request, + build_providers_get_request, + build_providers_list_at_tenant_scope_request, + build_providers_list_request, + build_providers_provider_permissions_request, + build_providers_register_at_management_group_scope_request, + build_providers_register_request, + build_providers_unregister_request, + build_resource_groups_check_existence_request, + build_resource_groups_create_or_update_request, + build_resource_groups_delete_request, + build_resource_groups_export_template_request, + build_resource_groups_get_request, + build_resource_groups_list_request, + build_resource_groups_update_request, + build_resources_check_existence_by_id_request, + build_resources_check_existence_request, + build_resources_create_or_update_by_id_request, + build_resources_create_or_update_request, + build_resources_delete_by_id_request, + build_resources_delete_request, + build_resources_get_by_id_request, + build_resources_get_request, + build_resources_list_by_resource_group_request, + build_resources_list_request, + build_resources_move_resources_request, + build_resources_update_by_id_request, + build_resources_update_request, + build_resources_validate_move_resources_request, + build_tags_create_or_update_at_scope_request, + build_tags_create_or_update_request, + build_tags_create_or_update_value_request, + build_tags_delete_at_scope_request, + build_tags_delete_request, + build_tags_delete_value_request, + build_tags_get_at_scope_request, + build_tags_list_request, + build_tags_update_at_scope_request, +) +from .._configuration import ResourceManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """Lists all of the available Microsoft.Resources REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`deployments` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + async def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def check_existence_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _create_or_update_at_scope_initial( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_at_scope( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _validate_at_scope_initial( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_at_scope( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def export_template_at_scope( + self, scope: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_scope( + self, scope: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentExtended"]: + """Get all the deployments at the given scope. + + :param scope: The resource scope. Required. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_scope_request( + scope=scope, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _delete_at_tenant_scope_initial(self, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_at_tenant_scope_initial( + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def check_existence_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _create_or_update_at_tenant_scope_initial( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_create_or_update_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _validate_at_tenant_scope_initial( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_validate_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _what_if_at_tenant_scope_initial( + self, deployment_name: str, parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeploymentWhatIf") + + _request = build_deployments_what_if_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_what_if_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_what_if_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_what_if_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def export_template_at_tenant_scope( + self, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_tenant_scope( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentExtended"]: + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_tenant_scope_request( + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_at_management_group_scope( + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def check_existence_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> bool: + """Checks whether the deployment exists. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _create_or_update_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_create_or_update_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_at_management_group_scope( + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExtended: + """Gets a deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel_at_management_group_scope(self, group_id: str, deployment_name: str, **kwargs: Any) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _validate_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_validate_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_at_management_group_scope( + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _what_if_at_management_group_scope_initial( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeploymentWhatIf") + + _request = build_deployments_what_if_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def export_template_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_management_group_scope( + self, group_id: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentExtended"]: + """Get all the deployments for a management group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_management_group_scope_request( + group_id=group_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def check_existence_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _create_or_update_at_subscription_scope_initial( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _validate_at_subscription_scope_initial( + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_at_subscription_scope( + self, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_at_subscription_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_at_subscription_scope( + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _what_if_at_subscription_scope_initial( + self, deployment_name: str, parameters: Union[_models.DeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DeploymentWhatIf") + + _request = build_deployments_what_if_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_what_if_at_subscription_scope( + self, + deployment_name: str, + parameters: _models.DeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_what_if_at_subscription_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_what_if_at_subscription_scope( + self, deployment_name: str, parameters: Union[_models.DeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def export_template_at_subscription_scope( + self, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_subscription_scope( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentExtended"]: + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_subscription_scope_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _delete_initial( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def check_existence(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def cancel(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + async def _validate_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of AsyncLROPoller that returns either DeploymentValidateResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _what_if_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.DeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DeploymentWhatIf") + + _request = build_deployments_what_if_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.DeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.DeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either WhatIfOperationResult or the result + of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def export_template( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentExtended"]: + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def calculate_template_hash(self, template: JSON, **kwargs: Any) -> _models.TemplateHashResult: + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. Required. + :type template: JSON + :return: TemplateHashResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateHashResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.TemplateHashResult] = kwargs.pop("cls", None) + + _json = self._serialize.body(template, "object") + + _request = build_deployments_calculate_template_hash_request( + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("TemplateHashResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`providers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def unregister(self, resource_provider_namespace: str, **kwargs: Any) -> _models.Provider: + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + Required. + :type resource_provider_namespace: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_unregister_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def register_at_management_group_scope( + self, resource_provider_namespace: str, group_id: str, **kwargs: Any + ) -> None: + """Registers a management group with a resource provider. Use this operation to register a + resource provider with resource types that can be deployed at the management group scope. It + does not recursively register subscriptions within the management group. Instead, you must + register subscriptions individually. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param group_id: The management group ID. Required. + :type group_id: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_providers_register_at_management_group_scope_request( + resource_provider_namespace=resource_provider_namespace, + group_id=group_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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, {}) # type: ignore + + @distributed_trace_async + async def provider_permissions( + self, resource_provider_namespace: str, **kwargs: Any + ) -> _models.ProviderPermissionListResult: + """Get the provider permissions. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :return: ProviderPermissionListResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderPermissionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderPermissionListResult] = kwargs.pop("cls", None) + + _request = build_providers_provider_permissions_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ProviderPermissionListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def register( + self, + resource_provider_namespace: str, + properties: Optional[_models.ProviderRegistrationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Default value is None. + :type properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderRegistrationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def register( + self, + resource_provider_namespace: str, + properties: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Default value is None. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def register( + self, + resource_provider_namespace: str, + properties: Optional[Union[_models.ProviderRegistrationRequest, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO[bytes] type. Default value is None. + :type properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderRegistrationRequest + or IO[bytes] + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + if properties is not None: + _json = self._serialize.body(properties, "ProviderRegistrationRequest") + else: + _json = None + + _request = build_providers_register_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Provider"]: + """Gets all resource providers for a subscription. + + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: An iterator like instance of either Provider or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_providers_list_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def list_at_tenant_scope(self, expand: Optional[str] = None, **kwargs: Any) -> AsyncIterable["_models.Provider"]: + """Gets all resource providers for the tenant. + + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: An iterator like instance of either Provider or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_providers_list_at_tenant_scope_request( + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def get( + self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.Provider: + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_get_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_at_tenant_scope( + self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.Provider: + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_get_at_tenant_scope_request( + resource_provider_namespace=resource_provider_namespace, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProviderResourceTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`provider_resource_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def list( + self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.ProviderResourceTypeListResult: + """List the resource types for a specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: ProviderResourceTypeListResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderResourceTypeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderResourceTypeListResult] = kwargs.pop("cls", None) + + _request = build_provider_resource_types_list_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ProviderResourceTypeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable["_models.GenericResourceExpanded"]: + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The + properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, + resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, + plan/version, and plan/promotionCode.\\ :code:`
`\\ :code:`
`For example, to filter by a + resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'\\ + :code:`
`\\ :code:`
`You can use substringof(value, property) in the filter. The + properties you can use for substring are: name and resourceGroup.\\ :code:`
`\\ + :code:`
`For example, to get all resources with 'demo' anywhere in the name, use: + $filter=substringof('demo', name)\\ :code:`
`\\ :code:`
`You can link more than one + substringof together by adding and/or operators.\\ :code:`
`\\ :code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each + resource are not returned in the results.\\ :code:`
`\\ :code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. Default + value is None. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\\ , ``changedTime`` and ``provisioningState``. For + example, ``$expand=createdTime,changedTime``. Default value is None. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. Default + value is None. + :type top: int + :return: An iterator like instance of either GenericResourceExpanded or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _move_resources_initial( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourcesMoveInfo") + + _request = build_resources_move_resources_request( + source_resource_group_name=source_resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_move_resources( + self, + source_resource_group_name: str, + parameters: _models.ResourcesMoveInfo, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_move_resources( + self, + source_resource_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_move_resources( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo or + IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _validate_move_resources_initial( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourcesMoveInfo") + + _request = build_resources_validate_move_resources_request( + source_resource_group_name=source_resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: _models.ResourcesMoveInfo, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @overload + async def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :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: + """ + + @distributed_trace_async + async def begin_validate_move_resources( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo or + IO[bytes] + :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: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.GenericResourceExpanded"]: + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter + comparison operators include ``eq`` (equals) and ``ne`` (not equals) and may be used with the + following properties: ``location``\\ , ``resourceType``\\ , ``name``\\ , ``resourceGroup``\\ , + ``identity``\\ , ``identity/principalId``\\ , ``plan``\\ , ``plan/publisher``\\ , + ``plan/product``\\ , ``plan/name``\\ , ``plan/version``\\ , and ``plan/promotionCode``.\\ + :code:`
`\\ :code:`
`For example, to filter by a resource type, use + ``$filter=resourceType eq 'Microsoft.Network/virtualNetworks'``\\ :code:`
`\\ :code:`
`\\ + :code:`
`\\ ``substringof(value, property)`` can be used to filter for substrings of the + following currently-supported properties: ``name`` and ``resourceGroup``\\ :code:`
`\\ + :code:`
`For example, to get all resources with 'demo' anywhere in the resource name, use + ``$filter=substringof('demo', name)``\\ :code:`
`\\ :code:`
`Multiple substring + operations can also be combined using ``and``\\ /\\ ``or`` operators.\\ :code:`
`\\ + :code:`
`Note that any truncated number of results queried via ``$top`` may also not be + compatible when using a filter.\\ :code:`
`\\ :code:`
`\\ :code:`
`Resources can be + filtered by tag names and values. For example, to filter for a tag name and value, use + ``$filter=tagName eq 'tag1' and tagValue eq 'Value1'``. Note that when resources are filtered + by tag name and value, :code:`the original tags for each resource will not be returned in + the results.` Any list of additional properties queried via ``$expand`` may also not be + compatible when filtering by tag names/values. :code:`
`\\ :code:`
`For tag names only, + resources can be filtered by prefix using the following syntax: ``$filter=startswith(tagName, + 'depart')``. This query will return all resources with a tag name prefixed by the phrase + ``depart`` (i.e.\\ ``department``\\ , ``departureDate``\\ , ``departureTime``\\ , etc.)\\ + :code:`
`\\ :code:`
`\\ :code:`
`Note that some properties can be combined when + filtering resources, which include the following: ``substringof() and/or resourceType``\\ , + ``plan and plan/publisher and plan/name``\\ , and ``identity and identity/principalId``. + Default value is None. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\\ , ``changedTime`` and ``provisioningState``. For + example, ``$expand=createdTime,changedTime``. Default value is None. + :type expand: str + :param top: The number of recommendations per page if a paged version of this API is being + used. Default value is None. + :type top: int + :return: An iterator like instance of either GenericResourceExpanded or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resources_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def check_existence( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> bool: + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type. Required. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resources_check_existence_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _delete_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resources_delete_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type. Required. + :type resource_type: str + :param resource_name: The name of the resource to delete. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_update_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> _models.GenericResource: + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. Required. + :type resource_type: str + :param resource_name: The name of the resource to get. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: GenericResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + + _request = build_resources_get_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("GenericResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: + """Checks by ID whether a resource exists. This API currently works only for a limited set of + Resource providers. In the event that a Resource provider does not implement this API, ARM will + respond with a 405. The alternative then is to use the GET API to check for the existence of + the resource. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resources_check_existence_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + async def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resources_delete_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _create_or_update_by_id_initial( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_create_or_update_by_id_request( + resource_id=resource_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_by_id( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_by_id_initial( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_update_by_id_request( + resource_id=resource_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_by_id( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Is either a GenericResource type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: GenericResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + + _request = build_resources_get_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("GenericResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ResourceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`resource_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def check_existence(self, resource_group_name: str, **kwargs: Any) -> bool: + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. Required. + :type resource_group_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resource_groups_check_existence_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + @overload + async def create_or_update( + self, + resource_group_name: str, + parameters: _models.ResourceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, resource_group_name: str, parameters: Union[_models.ResourceGroup, IO[bytes]], **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Is either a + ResourceGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup or IO[bytes] + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGroup") + + _request = build_resource_groups_create_or_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, force_deletion_types: Optional[str] = None, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resource_groups_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + force_deletion_types=force_deletion_types, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, force_deletion_types: Optional[str] = None, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. Required. + :type resource_group_name: str + :param force_deletion_types: The resource types you want to force delete. Currently, only the + following is supported: + forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + Default value is None. + :type force_deletion_types: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + force_deletion_types=force_deletion_types, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace_async + async def get(self, resource_group_name: str, **kwargs: Any) -> _models.ResourceGroup: + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. Required. + :type resource_group_name: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + _request = build_resource_groups_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + parameters: _models.ResourceGroupPatchable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupPatchable + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, resource_group_name: str, parameters: Union[_models.ResourceGroupPatchable, IO[bytes]], **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupPatchable or + IO[bytes] + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGroupPatchable") + + _request = build_resource_groups_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _export_template_initial( + self, resource_group_name: str, parameters: Union[_models.ExportTemplateRequest, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ExportTemplateRequest") + + _request = build_resource_groups_export_template_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_export_template( + self, + resource_group_name: str, + parameters: _models.ExportTemplateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_export_template( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_export_template( + self, resource_group_name: str, parameters: Union[_models.ExportTemplateRequest, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateRequest or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either ResourceGroupExportResult or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroupExportResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ResourceGroupExportResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ResourceGroupExportResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ResourceGroupExportResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.ResourceGroup"]: + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`You can + filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. Default value is None. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + Default value is None. + :type top: int + :return: An iterator like instance of either ResourceGroup or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resource_groups_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + +class TagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`tags` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def delete_value(self, tag_name: str, tag_value: str, **kwargs: Any) -> None: + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :param tag_value: The value of the tag to delete. Required. + :type tag_value: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_tags_delete_value_request( + tag_name=tag_name, + tag_value=tag_value, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace_async + async def create_or_update_value(self, tag_name: str, tag_value: str, **kwargs: Any) -> _models.TagValue: + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :param tag_value: The value of the tag to create. Required. + :type tag_value: str + :return: TagValue or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagValue] = kwargs.pop("cls", None) + + _request = build_tags_create_or_update_value_request( + tag_name=tag_name, + tag_value=tag_value, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("TagValue", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def create_or_update(self, tag_name: str, **kwargs: Any) -> _models.TagDetails: + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. Required. + :type tag_name: str + :return: TagDetails or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagDetails] = kwargs.pop("cls", None) + + _request = build_tags_create_or_update_request( + tag_name=tag_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("TagDetails", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def delete(self, tag_name: str, **kwargs: Any) -> None: + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_tags_delete_request( + tag_name=tag_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.TagDetails"]: + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :return: An iterator like instance of either TagDetails or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_tags_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("TagsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + async def _create_or_update_at_scope_initial( + self, scope: str, parameters: Union[_models.TagsResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsResource") + + _request = build_tags_create_or_update_at_scope_request( + scope=scope, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update_at_scope( + self, scope: str, parameters: _models.TagsResource, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update_at_scope( + self, scope: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update_at_scope( + self, scope: str, parameters: Union[_models.TagsResource, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Is either a TagsResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource or IO[bytes] + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_at_scope_initial( + scope=scope, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TagsResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.TagsResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.TagsResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_at_scope_initial( + self, scope: str, parameters: Union[_models.TagsPatchResource, IO[bytes]], **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsPatchResource") + + _request = build_tags_update_at_scope_request( + scope=scope, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update_at_scope( + self, + scope: str, + parameters: _models.TagsPatchResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update_at_scope( + self, scope: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update_at_scope( + self, scope: str, parameters: Union[_models.TagsPatchResource, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Is either a TagsPatchResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchResource or + IO[bytes] + :return: An instance of AsyncLROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_at_scope_initial( + scope=scope, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TagsResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.TagsResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.TagsResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get_at_scope(self, scope: str, **kwargs: Any) -> _models.TagsResource: + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. Required. + :type scope: str + :return: TagsResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + + _request = build_tags_get_at_scope_request( + scope=scope, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("TagsResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_at_scope_initial(self, scope: str, **kwargs: Any) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_tags_delete_at_scope_request( + scope=scope, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete_at_scope(self, scope: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. Required. + :type scope: str + :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: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_at_scope_initial( + scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DeploymentOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.aio.ResourceManagementClient`'s + :attr:`deployment_operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace_async + async def get_at_scope( + self, scope: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_scope_request( + scope=scope, + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_scope( + self, scope: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_scope_request( + scope=scope, + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def get_at_tenant_scope( + self, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_tenant_scope_request( + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_tenant_scope( + self, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_tenant_scope_request( + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def get_at_management_group_scope( + self, group_id: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_management_group_scope( + self, group_id: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def get_at_subscription_scope( + self, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_subscription_scope_request( + deployment_name=deployment_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_subscription_scope( + self, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace_async + async def get( + self, resource_group_name: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> AsyncIterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_patch.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/aio/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/__init__.py new file mode 100644 index 000000000000..c40dde43d5f1 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/__init__.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. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + Alias, + AliasPath, + AliasPathMetadata, + AliasPattern, + ApiProfile, + BasicDependency, + DebugSetting, + Dependency, + Deployment, + DeploymentDiagnosticsDefinition, + DeploymentExportResult, + DeploymentExtended, + DeploymentExtendedFilter, + DeploymentExtensionConfigItem, + DeploymentExtensionDefinition, + DeploymentListResult, + DeploymentOperation, + DeploymentOperationProperties, + DeploymentOperationsListResult, + DeploymentParameter, + DeploymentProperties, + DeploymentPropertiesExtended, + DeploymentValidateResult, + DeploymentWhatIf, + DeploymentWhatIfProperties, + DeploymentWhatIfSettings, + ErrorAdditionalInfo, + ErrorResponse, + ExportTemplateRequest, + ExpressionEvaluationOptions, + ExtendedLocation, + GenericResource, + GenericResourceExpanded, + GenericResourceFilter, + HttpMessage, + Identity, + IdentityUserAssignedIdentitiesValue, + KeyVaultParameterReference, + KeyVaultReference, + OnErrorDeployment, + OnErrorDeploymentExtended, + Operation, + OperationDisplay, + OperationListResult, + ParametersLink, + Permission, + Plan, + Provider, + ProviderConsentDefinition, + ProviderExtendedLocation, + ProviderListResult, + ProviderPermission, + ProviderPermissionListResult, + ProviderRegistrationRequest, + ProviderResourceType, + ProviderResourceTypeListResult, + Resource, + ResourceGroup, + ResourceGroupExportResult, + ResourceGroupFilter, + ResourceGroupListResult, + ResourceGroupPatchable, + ResourceGroupProperties, + ResourceListResult, + ResourceProviderOperationDisplayProperties, + ResourceReference, + ResourcesMoveInfo, + RoleDefinition, + ScopedDeployment, + ScopedDeploymentWhatIf, + Sku, + StatusMessage, + SubResource, + TagCount, + TagDetails, + TagValue, + Tags, + TagsListResult, + TagsPatchResource, + TagsResource, + TargetResource, + TemplateHashResult, + TemplateLink, + WhatIfChange, + WhatIfOperationResult, + WhatIfPropertyChange, + ZoneMapping, +) + +from ._resource_management_client_enums import ( # type: ignore + AliasPathAttributes, + AliasPathTokenType, + AliasPatternType, + AliasType, + ChangeType, + DeploymentMode, + ExportTemplateOutputFormat, + ExpressionEvaluationOptionsScopeType, + ExtendedLocationType, + ExtensionConfigPropertyType, + Level, + OnErrorDeploymentType, + PropertyChangeType, + ProviderAuthorizationConsentState, + ProvisioningOperation, + ProvisioningState, + ResourceIdentityType, + TagsPatchOperation, + ValidationLevel, + WhatIfResultFormat, +) +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Alias", + "AliasPath", + "AliasPathMetadata", + "AliasPattern", + "ApiProfile", + "BasicDependency", + "DebugSetting", + "Dependency", + "Deployment", + "DeploymentDiagnosticsDefinition", + "DeploymentExportResult", + "DeploymentExtended", + "DeploymentExtendedFilter", + "DeploymentExtensionConfigItem", + "DeploymentExtensionDefinition", + "DeploymentListResult", + "DeploymentOperation", + "DeploymentOperationProperties", + "DeploymentOperationsListResult", + "DeploymentParameter", + "DeploymentProperties", + "DeploymentPropertiesExtended", + "DeploymentValidateResult", + "DeploymentWhatIf", + "DeploymentWhatIfProperties", + "DeploymentWhatIfSettings", + "ErrorAdditionalInfo", + "ErrorResponse", + "ExportTemplateRequest", + "ExpressionEvaluationOptions", + "ExtendedLocation", + "GenericResource", + "GenericResourceExpanded", + "GenericResourceFilter", + "HttpMessage", + "Identity", + "IdentityUserAssignedIdentitiesValue", + "KeyVaultParameterReference", + "KeyVaultReference", + "OnErrorDeployment", + "OnErrorDeploymentExtended", + "Operation", + "OperationDisplay", + "OperationListResult", + "ParametersLink", + "Permission", + "Plan", + "Provider", + "ProviderConsentDefinition", + "ProviderExtendedLocation", + "ProviderListResult", + "ProviderPermission", + "ProviderPermissionListResult", + "ProviderRegistrationRequest", + "ProviderResourceType", + "ProviderResourceTypeListResult", + "Resource", + "ResourceGroup", + "ResourceGroupExportResult", + "ResourceGroupFilter", + "ResourceGroupListResult", + "ResourceGroupPatchable", + "ResourceGroupProperties", + "ResourceListResult", + "ResourceProviderOperationDisplayProperties", + "ResourceReference", + "ResourcesMoveInfo", + "RoleDefinition", + "ScopedDeployment", + "ScopedDeploymentWhatIf", + "Sku", + "StatusMessage", + "SubResource", + "TagCount", + "TagDetails", + "TagValue", + "Tags", + "TagsListResult", + "TagsPatchResource", + "TagsResource", + "TargetResource", + "TemplateHashResult", + "TemplateLink", + "WhatIfChange", + "WhatIfOperationResult", + "WhatIfPropertyChange", + "ZoneMapping", + "AliasPathAttributes", + "AliasPathTokenType", + "AliasPatternType", + "AliasType", + "ChangeType", + "DeploymentMode", + "ExportTemplateOutputFormat", + "ExpressionEvaluationOptionsScopeType", + "ExtendedLocationType", + "ExtensionConfigPropertyType", + "Level", + "OnErrorDeploymentType", + "PropertyChangeType", + "ProviderAuthorizationConsentState", + "ProvisioningOperation", + "ProvisioningState", + "ResourceIdentityType", + "TagsPatchOperation", + "ValidationLevel", + "WhatIfResultFormat", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_models_py3.py new file mode 100644 index 000000000000..f5dff2641dac --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_models_py3.py @@ -0,0 +1,4017 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union + +from ... import _serialization + +if TYPE_CHECKING: + from .. import models as _models +JSON = MutableMapping[str, Any] + + +class Alias(_serialization.Model): + """The alias type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The alias name. + :vartype name: str + :ivar paths: The paths for an alias. + :vartype paths: list[~azure.mgmt.resource.resources.v2025_03_01.models.AliasPath] + :ivar type: The type of the alias. Known values are: "NotSpecified", "PlainText", and "Mask". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.AliasType + :ivar default_path: The default path for an alias. + :vartype default_path: str + :ivar default_pattern: The default pattern for an alias. + :vartype default_pattern: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPattern + :ivar default_metadata: The default alias path metadata. Applies to the default path and to any + alias path that doesn't have metadata. + :vartype default_metadata: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPathMetadata + """ + + _validation = { + "default_metadata": {"readonly": True}, + } + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "paths": {"key": "paths", "type": "[AliasPath]"}, + "type": {"key": "type", "type": "str"}, + "default_path": {"key": "defaultPath", "type": "str"}, + "default_pattern": {"key": "defaultPattern", "type": "AliasPattern"}, + "default_metadata": {"key": "defaultMetadata", "type": "AliasPathMetadata"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + paths: Optional[List["_models.AliasPath"]] = None, + type: Optional[Union[str, "_models.AliasType"]] = None, + default_path: Optional[str] = None, + default_pattern: Optional["_models.AliasPattern"] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The alias name. + :paramtype name: str + :keyword paths: The paths for an alias. + :paramtype paths: list[~azure.mgmt.resource.resources.v2025_03_01.models.AliasPath] + :keyword type: The type of the alias. Known values are: "NotSpecified", "PlainText", and + "Mask". + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.AliasType + :keyword default_path: The default path for an alias. + :paramtype default_path: str + :keyword default_pattern: The default pattern for an alias. + :paramtype default_pattern: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPattern + """ + super().__init__(**kwargs) + self.name = name + self.paths = paths + self.type = type + self.default_path = default_path + self.default_pattern = default_pattern + self.default_metadata: Optional["_models.AliasPathMetadata"] = None + + +class AliasPath(_serialization.Model): + """The type of the paths for alias. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar path: The path of an alias. + :vartype path: str + :ivar api_versions: The API versions. + :vartype api_versions: list[str] + :ivar pattern: The pattern for an alias path. + :vartype pattern: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPattern + :ivar metadata: The metadata of the alias path. If missing, fall back to the default metadata + of the alias. + :vartype metadata: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPathMetadata + """ + + _validation = { + "metadata": {"readonly": True}, + } + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "api_versions": {"key": "apiVersions", "type": "[str]"}, + "pattern": {"key": "pattern", "type": "AliasPattern"}, + "metadata": {"key": "metadata", "type": "AliasPathMetadata"}, + } + + def __init__( + self, + *, + path: Optional[str] = None, + api_versions: Optional[List[str]] = None, + pattern: Optional["_models.AliasPattern"] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: The path of an alias. + :paramtype path: str + :keyword api_versions: The API versions. + :paramtype api_versions: list[str] + :keyword pattern: The pattern for an alias path. + :paramtype pattern: ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPattern + """ + super().__init__(**kwargs) + self.path = path + self.api_versions = api_versions + self.pattern = pattern + self.metadata: Optional["_models.AliasPathMetadata"] = None + + +class AliasPathMetadata(_serialization.Model): + """AliasPathMetadata. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The type of the token that the alias path is referring to. Known values are: + "NotSpecified", "Any", "String", "Object", "Array", "Integer", "Number", and "Boolean". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPathTokenType + :ivar attributes: The attributes of the token that the alias path is referring to. Known values + are: "None" and "Modifiable". + :vartype attributes: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPathAttributes + """ + + _validation = { + "type": {"readonly": True}, + "attributes": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "attributes": {"key": "attributes", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[Union[str, "_models.AliasPathTokenType"]] = None + self.attributes: Optional[Union[str, "_models.AliasPathAttributes"]] = None + + +class AliasPattern(_serialization.Model): + """The type of the pattern for an alias path. + + :ivar phrase: The alias pattern phrase. + :vartype phrase: str + :ivar variable: The alias pattern variable. + :vartype variable: str + :ivar type: The type of alias pattern. Known values are: "NotSpecified" and "Extract". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPatternType + """ + + _attribute_map = { + "phrase": {"key": "phrase", "type": "str"}, + "variable": {"key": "variable", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + phrase: Optional[str] = None, + variable: Optional[str] = None, + type: Optional[Union[str, "_models.AliasPatternType"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword phrase: The alias pattern phrase. + :paramtype phrase: str + :keyword variable: The alias pattern variable. + :paramtype variable: str + :keyword type: The type of alias pattern. Known values are: "NotSpecified" and "Extract". + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.AliasPatternType + """ + super().__init__(**kwargs) + self.phrase = phrase + self.variable = variable + self.type = type + + +class ApiProfile(_serialization.Model): + """ApiProfile. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar profile_version: The profile version. + :vartype profile_version: str + :ivar api_version: The API version. + :vartype api_version: str + """ + + _validation = { + "profile_version": {"readonly": True}, + "api_version": {"readonly": True}, + } + + _attribute_map = { + "profile_version": {"key": "profileVersion", "type": "str"}, + "api_version": {"key": "apiVersion", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.profile_version: Optional[str] = None + self.api_version: Optional[str] = None + + +class BasicDependency(_serialization.Model): + """Deployment dependency information. + + :ivar id: The ID of the dependency. + :vartype id: str + :ivar resource_type: The dependency resource type. + :vartype resource_type: str + :ivar resource_name: The dependency resource name. + :vartype resource_name: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The ID of the dependency. + :paramtype id: str + :keyword resource_type: The dependency resource type. + :paramtype resource_type: str + :keyword resource_name: The dependency resource name. + :paramtype resource_name: str + """ + super().__init__(**kwargs) + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class DebugSetting(_serialization.Model): + """The debug setting. + + :ivar detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :vartype detail_level: str + """ + + _attribute_map = { + "detail_level": {"key": "detailLevel", "type": "str"}, + } + + def __init__(self, *, detail_level: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword detail_level: Specifies the type of information to log for debugging. The permitted + values are none, requestContent, responseContent, or both requestContent and responseContent + separated by a comma. The default is none. When setting this value, carefully consider the type + of information you are passing in during deployment. By logging information about the request + or response, you could potentially expose sensitive data that is retrieved through the + deployment operations. + :paramtype detail_level: str + """ + super().__init__(**kwargs) + self.detail_level = detail_level + + +class Dependency(_serialization.Model): + """Deployment dependency information. + + :ivar depends_on: The list of dependencies. + :vartype depends_on: list[~azure.mgmt.resource.resources.v2025_03_01.models.BasicDependency] + :ivar id: The ID of the dependency. + :vartype id: str + :ivar resource_type: The dependency resource type. + :vartype resource_type: str + :ivar resource_name: The dependency resource name. + :vartype resource_name: str + """ + + _attribute_map = { + "depends_on": {"key": "dependsOn", "type": "[BasicDependency]"}, + "id": {"key": "id", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + } + + def __init__( + self, + *, + depends_on: Optional[List["_models.BasicDependency"]] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + resource_type: Optional[str] = None, + resource_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword depends_on: The list of dependencies. + :paramtype depends_on: list[~azure.mgmt.resource.resources.v2025_03_01.models.BasicDependency] + :keyword id: The ID of the dependency. + :paramtype id: str + :keyword resource_type: The dependency resource type. + :paramtype resource_type: str + :keyword resource_name: The dependency resource name. + :paramtype resource_name: str + """ + super().__init__(**kwargs) + self.depends_on = depends_on + self.id = id + self.resource_type = resource_type + self.resource_name = resource_name + + +class Deployment(_serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to server. + + :ivar location: The location to store the deployment data. + :vartype location: str + :ivar properties: The deployment properties. Required. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentProperties + :ivar tags: Deployment tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentProperties"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + properties: "_models.DeploymentProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location to store the deployment data. + :paramtype location: str + :keyword properties: The deployment properties. Required. + :paramtype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentProperties + :keyword tags: Deployment tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentDiagnosticsDefinition(_serialization.Model): + """DeploymentDiagnosticsDefinition. + + 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 server. + + :ivar level: Denotes the additional response level. Required. Known values are: "Warning", + "Info", and "Error". + :vartype level: str or ~azure.mgmt.resource.resources.v2025_03_01.models.Level + :ivar code: The error code. Required. + :vartype code: str + :ivar message: The error message. Required. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ErrorAdditionalInfo] + """ + + _validation = { + "level": {"required": True, "readonly": True}, + "code": {"required": True, "readonly": True}, + "message": {"required": True, "readonly": True}, + "target": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "level": {"key": "level", "type": "str"}, + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.level: Optional[Union[str, "_models.Level"]] = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None + + +class DeploymentExportResult(_serialization.Model): + """The deployment export result. + + :ivar template: The template content. + :vartype template: JSON + """ + + _attribute_map = { + "template": {"key": "template", "type": "object"}, + } + + def __init__(self, *, template: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword template: The template content. + :paramtype template: JSON + """ + super().__init__(**kwargs) + self.template = template + + +class DeploymentExtended(_serialization.Model): + """Deployment information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :ivar location: the location of the deployment. + :vartype location: str + :ivar properties: Deployment properties. + :vartype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentPropertiesExtended + :ivar tags: Deployment tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + properties: Optional["_models.DeploymentPropertiesExtended"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: the location of the deployment. + :paramtype location: str + :keyword properties: Deployment properties. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentPropertiesExtended + :keyword tags: Deployment tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.properties = properties + self.tags = tags + + +class DeploymentExtendedFilter(_serialization.Model): + """Deployment filter. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, *, provisioning_state: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword provisioning_state: The provisioning state. + :paramtype provisioning_state: str + """ + super().__init__(**kwargs) + self.provisioning_state = provisioning_state + + +class DeploymentExtensionConfigItem(_serialization.Model): + """DeploymentExtensionConfigItem. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The value type of the extension config property. Known values are: "String", "Int", + "Bool", "Array", "Object", "SecureString", "SecureObject", and "Int". + :vartype type: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ExtensionConfigPropertyType + :ivar value: The value of the extension config property. + :vartype value: any + :ivar key_vault_reference: The Azure Key Vault reference used to retrieve the secret value of + the extension config property. + :vartype key_vault_reference: + ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultParameterReference + """ + + _validation = { + "type": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "object"}, + "key_vault_reference": {"key": "keyVaultReference", "type": "KeyVaultParameterReference"}, + } + + def __init__( + self, + *, + value: Optional[Any] = None, + key_vault_reference: Optional["_models.KeyVaultParameterReference"] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: The value of the extension config property. + :paramtype value: any + :keyword key_vault_reference: The Azure Key Vault reference used to retrieve the secret value + of the extension config property. + :paramtype key_vault_reference: + ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultParameterReference + """ + super().__init__(**kwargs) + self.type: Optional[Union[str, "_models.ExtensionConfigPropertyType"]] = None + self.value = value + self.key_vault_reference = key_vault_reference + + +class DeploymentExtensionDefinition(_serialization.Model): + """DeploymentExtensionDefinition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar alias: The alias of the extension as defined in the deployment template. + :vartype alias: str + :ivar name: The extension name. + :vartype name: str + :ivar version: The extension version. + :vartype version: str + :ivar config_id: The extension configuration ID. It uniquely identifies a deployment control + plane within an extension. + :vartype config_id: str + :ivar config: The extension configuration. + :vartype config: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionConfigItem] + """ + + _validation = { + "alias": {"readonly": True}, + "name": {"readonly": True}, + "version": {"readonly": True}, + "config_id": {"readonly": True}, + "config": {"readonly": True}, + } + + _attribute_map = { + "alias": {"key": "alias", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "version": {"key": "version", "type": "str"}, + "config_id": {"key": "configId", "type": "str"}, + "config": {"key": "config", "type": "{DeploymentExtensionConfigItem}"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.alias: Optional[str] = None + self.name: Optional[str] = None + self.version: Optional[str] = None + self.config_id: Optional[str] = None + self.config: Optional[Dict[str, "_models.DeploymentExtensionConfigItem"]] = None + + +class DeploymentListResult(_serialization.Model): + """List of deployments. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of deployments. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DeploymentExtended]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DeploymentExtended"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of deployments. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class DeploymentOperation(_serialization.Model): + """Deployment operation information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full deployment operation ID. + :vartype id: str + :ivar operation_id: Deployment operation ID. + :vartype operation_id: str + :ivar properties: Deployment properties. + :vartype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperationProperties + """ + + _validation = { + "id": {"readonly": True}, + "operation_id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "operation_id": {"key": "operationId", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentOperationProperties"}, + } + + def __init__(self, *, properties: Optional["_models.DeploymentOperationProperties"] = None, **kwargs: Any) -> None: + """ + :keyword properties: Deployment properties. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperationProperties + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.operation_id: Optional[str] = None + self.properties = properties + + +class DeploymentOperationProperties(_serialization.Model): + """Deployment operation properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_operation: The name of the current provisioning operation. Known values are: + "NotSpecified", "Create", "Delete", "Waiting", "AzureAsyncOperationWaiting", + "ResourceCacheWaiting", "Action", "Read", "EvaluateDeploymentOutput", and "DeploymentCleanup". + :vartype provisioning_operation: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProvisioningOperation + :ivar provisioning_state: The state of the provisioning. + :vartype provisioning_state: str + :ivar timestamp: The date and time of the operation. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the operation. + :vartype duration: str + :ivar service_request_id: Deployment operation service request id. + :vartype service_request_id: str + :ivar status_code: Operation status code from the resource provider. This property may not be + set if a response has not yet been received. + :vartype status_code: str + :ivar status_message: Operation status message from the resource provider. This property is + optional. It will only be provided if an error was received from the resource provider. + :vartype status_message: ~azure.mgmt.resource.resources.v2025_03_01.models.StatusMessage + :ivar target_resource: The target resource. + :vartype target_resource: ~azure.mgmt.resource.resources.v2025_03_01.models.TargetResource + :ivar request: The HTTP request message. + :vartype request: ~azure.mgmt.resource.resources.v2025_03_01.models.HttpMessage + :ivar response: The HTTP response message. + :vartype response: ~azure.mgmt.resource.resources.v2025_03_01.models.HttpMessage + """ + + _validation = { + "provisioning_operation": {"readonly": True}, + "provisioning_state": {"readonly": True}, + "timestamp": {"readonly": True}, + "duration": {"readonly": True}, + "service_request_id": {"readonly": True}, + "status_code": {"readonly": True}, + "status_message": {"readonly": True}, + "target_resource": {"readonly": True}, + "request": {"readonly": True}, + "response": {"readonly": True}, + } + + _attribute_map = { + "provisioning_operation": {"key": "provisioningOperation", "type": "str"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "str"}, + "service_request_id": {"key": "serviceRequestId", "type": "str"}, + "status_code": {"key": "statusCode", "type": "str"}, + "status_message": {"key": "statusMessage", "type": "StatusMessage"}, + "target_resource": {"key": "targetResource", "type": "TargetResource"}, + "request": {"key": "request", "type": "HttpMessage"}, + "response": {"key": "response", "type": "HttpMessage"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_operation: Optional[Union[str, "_models.ProvisioningOperation"]] = None + self.provisioning_state: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.service_request_id: Optional[str] = None + self.status_code: Optional[str] = None + self.status_message: Optional["_models.StatusMessage"] = None + self.target_resource: Optional["_models.TargetResource"] = None + self.request: Optional["_models.HttpMessage"] = None + self.response: Optional["_models.HttpMessage"] = None + + +class DeploymentOperationsListResult(_serialization.Model): + """List of deployment operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of deployment operations. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[DeploymentOperation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.DeploymentOperation"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of deployment operations. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class DeploymentParameter(_serialization.Model): + """Deployment parameter for the template. + + :ivar value: Input value to the parameter . + :vartype value: any + :ivar reference: Azure Key Vault parameter reference. + :vartype reference: + ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultParameterReference + """ + + _attribute_map = { + "value": {"key": "value", "type": "object"}, + "reference": {"key": "reference", "type": "KeyVaultParameterReference"}, + } + + def __init__( + self, + *, + value: Optional[Any] = None, + reference: Optional["_models.KeyVaultParameterReference"] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: Input value to the parameter . + :paramtype value: any + :keyword reference: Azure Key Vault parameter reference. + :paramtype reference: + ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultParameterReference + """ + super().__init__(**kwargs) + self.value = value + self.reference = reference + + +class DeploymentProperties(_serialization.Model): + """Deployment properties. + + All required parameters must be populated in order to send to server. + + :ivar template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :vartype template: JSON + :ivar template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :vartype template_link: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateLink + :ivar parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :vartype parameters: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentParameter] + :ivar parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2025_03_01.models.ParametersLink + :ivar extension_configs: The configurations to use for deployment extensions. The keys of this + object are deployment extension aliases as defined in the deployment template. + :vartype extension_configs: dict[str, dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionConfigItem]] + :ivar mode: The mode that is used to deploy resources. This value can be either Incremental or + Complete. In Incremental mode, resources are deployed without deleting existing resources that + are not included in the template. In Complete mode, resources are deployed and existing + resources in the resource group that are not included in the template are deleted. Be careful + when using Complete mode as you may unintentionally delete resources. Required. Known values + are: "Incremental" and "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2025_03_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeployment + :ivar expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :vartype expression_evaluation_options: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptions + :ivar validation_level: The validation level of the deployment. Known values are: "Template", + "Provider", and "ProviderNoRbac". + :vartype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + """ + + _validation = { + "mode": {"required": True}, + } + + _attribute_map = { + "template": {"key": "template", "type": "object"}, + "template_link": {"key": "templateLink", "type": "TemplateLink"}, + "parameters": {"key": "parameters", "type": "{DeploymentParameter}"}, + "parameters_link": {"key": "parametersLink", "type": "ParametersLink"}, + "extension_configs": {"key": "extensionConfigs", "type": "{{DeploymentExtensionConfigItem}}"}, + "mode": {"key": "mode", "type": "str"}, + "debug_setting": {"key": "debugSetting", "type": "DebugSetting"}, + "on_error_deployment": {"key": "onErrorDeployment", "type": "OnErrorDeployment"}, + "expression_evaluation_options": {"key": "expressionEvaluationOptions", "type": "ExpressionEvaluationOptions"}, + "validation_level": {"key": "validationLevel", "type": "str"}, + } + + def __init__( + self, + *, + mode: Union[str, "_models.DeploymentMode"], + template: Optional[JSON] = None, + template_link: Optional["_models.TemplateLink"] = None, + parameters: Optional[Dict[str, "_models.DeploymentParameter"]] = None, + parameters_link: Optional["_models.ParametersLink"] = None, + extension_configs: Optional[Dict[str, Dict[str, "_models.DeploymentExtensionConfigItem"]]] = None, + debug_setting: Optional["_models.DebugSetting"] = None, + on_error_deployment: Optional["_models.OnErrorDeployment"] = None, + expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, + validation_level: Optional[Union[str, "_models.ValidationLevel"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword template: The template content. You use this element when you want to pass the + template syntax directly in the request rather than link to an existing template. It can be a + JObject or well-formed JSON string. Use either the templateLink property or the template + property, but not both. + :paramtype template: JSON + :keyword template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :paramtype template_link: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateLink + :keyword parameters: Name and value pairs that define the deployment parameters for the + template. You use this element when you want to provide the parameter values directly in the + request rather than link to an existing parameter file. Use either the parametersLink property + or the parameters property, but not both. It can be a JObject or a well formed JSON string. + :paramtype parameters: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentParameter] + :keyword parameters_link: The URI of parameters file. You use this element to link to an + existing parameters file. Use either the parametersLink property or the parameters property, + but not both. + :paramtype parameters_link: ~azure.mgmt.resource.resources.v2025_03_01.models.ParametersLink + :keyword extension_configs: The configurations to use for deployment extensions. The keys of + this object are deployment extension aliases as defined in the deployment template. + :paramtype extension_configs: dict[str, dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionConfigItem]] + :keyword mode: The mode that is used to deploy resources. This value can be either Incremental + or Complete. In Incremental mode, resources are deployed without deleting existing resources + that are not included in the template. In Complete mode, resources are deployed and existing + resources in the resource group that are not included in the template are deleted. Be careful + when using Complete mode as you may unintentionally delete resources. Required. Known values + are: "Incremental" and "Complete". + :paramtype mode: str or ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentMode + :keyword debug_setting: The debug setting of the deployment. + :paramtype debug_setting: ~azure.mgmt.resource.resources.v2025_03_01.models.DebugSetting + :keyword on_error_deployment: The deployment on error behavior. + :paramtype on_error_deployment: + ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeployment + :keyword expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :paramtype expression_evaluation_options: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptions + :keyword validation_level: The validation level of the deployment. Known values are: + "Template", "Provider", and "ProviderNoRbac". + :paramtype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + """ + super().__init__(**kwargs) + self.template = template + self.template_link = template_link + self.parameters = parameters + self.parameters_link = parameters_link + self.extension_configs = extension_configs + self.mode = mode + self.debug_setting = debug_setting + self.on_error_deployment = on_error_deployment + self.expression_evaluation_options = expression_evaluation_options + self.validation_level = validation_level + + +class DeploymentPropertiesExtended(_serialization.Model): + """Deployment properties with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Denotes the state of provisioning. Known values are: "NotSpecified", + "Accepted", "Running", "Ready", "Creating", "Created", "Deleting", "Deleted", "Canceled", + "Failed", "Succeeded", and "Updating". + :vartype provisioning_state: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProvisioningState + :ivar correlation_id: The correlation ID of the deployment. + :vartype correlation_id: str + :ivar timestamp: The timestamp of the template deployment. + :vartype timestamp: ~datetime.datetime + :ivar duration: The duration of the template deployment. + :vartype duration: str + :ivar outputs: Key/value pairs that represent deployment output. + :vartype outputs: JSON + :ivar providers: The list of resource providers needed for the deployment. + :vartype providers: list[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :ivar dependencies: The list of deployment dependencies. + :vartype dependencies: list[~azure.mgmt.resource.resources.v2025_03_01.models.Dependency] + :ivar template_link: The URI referencing the template. + :vartype template_link: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateLink + :ivar parameters: Deployment parameters. + :vartype parameters: JSON + :ivar parameters_link: The URI referencing the parameters. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2025_03_01.models.ParametersLink + :ivar extensions: The extensions used in this deployment. + :vartype extensions: + list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionDefinition] + :ivar mode: The deployment mode. Possible values are Incremental and Complete. Known values + are: "Incremental" and "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2025_03_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeploymentExtended + :ivar template_hash: The hash produced for the template. + :vartype template_hash: str + :ivar output_resources: Array of provisioned resources. + :vartype output_resources: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceReference] + :ivar validated_resources: Array of validated resources. + :vartype validated_resources: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceReference] + :ivar error: The deployment error. + :vartype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + :ivar diagnostics: Contains diagnostic information collected during validation process. + :vartype diagnostics: + list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentDiagnosticsDefinition] + :ivar validation_level: The validation level of the deployment. Known values are: "Template", + "Provider", and "ProviderNoRbac". + :vartype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + """ + + _validation = { + "provisioning_state": {"readonly": True}, + "correlation_id": {"readonly": True}, + "timestamp": {"readonly": True}, + "duration": {"readonly": True}, + "outputs": {"readonly": True}, + "providers": {"readonly": True}, + "dependencies": {"readonly": True}, + "template_link": {"readonly": True}, + "parameters": {"readonly": True}, + "parameters_link": {"readonly": True}, + "extensions": {"readonly": True}, + "mode": {"readonly": True}, + "debug_setting": {"readonly": True}, + "on_error_deployment": {"readonly": True}, + "template_hash": {"readonly": True}, + "output_resources": {"readonly": True}, + "validated_resources": {"readonly": True}, + "error": {"readonly": True}, + "diagnostics": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "correlation_id": {"key": "correlationId", "type": "str"}, + "timestamp": {"key": "timestamp", "type": "iso-8601"}, + "duration": {"key": "duration", "type": "str"}, + "outputs": {"key": "outputs", "type": "object"}, + "providers": {"key": "providers", "type": "[Provider]"}, + "dependencies": {"key": "dependencies", "type": "[Dependency]"}, + "template_link": {"key": "templateLink", "type": "TemplateLink"}, + "parameters": {"key": "parameters", "type": "object"}, + "parameters_link": {"key": "parametersLink", "type": "ParametersLink"}, + "extensions": {"key": "extensions", "type": "[DeploymentExtensionDefinition]"}, + "mode": {"key": "mode", "type": "str"}, + "debug_setting": {"key": "debugSetting", "type": "DebugSetting"}, + "on_error_deployment": {"key": "onErrorDeployment", "type": "OnErrorDeploymentExtended"}, + "template_hash": {"key": "templateHash", "type": "str"}, + "output_resources": {"key": "outputResources", "type": "[ResourceReference]"}, + "validated_resources": {"key": "validatedResources", "type": "[ResourceReference]"}, + "error": {"key": "error", "type": "ErrorResponse"}, + "diagnostics": {"key": "diagnostics", "type": "[DeploymentDiagnosticsDefinition]"}, + "validation_level": {"key": "validationLevel", "type": "str"}, + } + + def __init__( + self, *, validation_level: Optional[Union[str, "_models.ValidationLevel"]] = None, **kwargs: Any + ) -> None: + """ + :keyword validation_level: The validation level of the deployment. Known values are: + "Template", "Provider", and "ProviderNoRbac". + :paramtype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None + self.correlation_id: Optional[str] = None + self.timestamp: Optional[datetime.datetime] = None + self.duration: Optional[str] = None + self.outputs: Optional[JSON] = None + self.providers: Optional[List["_models.Provider"]] = None + self.dependencies: Optional[List["_models.Dependency"]] = None + self.template_link: Optional["_models.TemplateLink"] = None + self.parameters: Optional[JSON] = None + self.parameters_link: Optional["_models.ParametersLink"] = None + self.extensions: Optional[List["_models.DeploymentExtensionDefinition"]] = None + self.mode: Optional[Union[str, "_models.DeploymentMode"]] = None + self.debug_setting: Optional["_models.DebugSetting"] = None + self.on_error_deployment: Optional["_models.OnErrorDeploymentExtended"] = None + self.template_hash: Optional[str] = None + self.output_resources: Optional[List["_models.ResourceReference"]] = None + self.validated_resources: Optional[List["_models.ResourceReference"]] = None + self.error: Optional["_models.ErrorResponse"] = None + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None + self.validation_level = validation_level + + +class DeploymentValidateResult(_serialization.Model): + """Information from validate template deployment response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The deployment validation error. + :vartype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + :ivar id: The ID of the deployment. + :vartype id: str + :ivar name: The name of the deployment. + :vartype name: str + :ivar type: The type of the deployment. + :vartype type: str + :ivar properties: The template deployment properties. + :vartype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentPropertiesExtended + """ + + _validation = { + "error": {"readonly": True}, + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "error": {"key": "error", "type": "ErrorResponse"}, + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentPropertiesExtended"}, + } + + def __init__(self, *, properties: Optional["_models.DeploymentPropertiesExtended"] = None, **kwargs: Any) -> None: + """ + :keyword properties: The template deployment properties. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentPropertiesExtended + """ + super().__init__(**kwargs) + self.error: Optional["_models.ErrorResponse"] = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.properties = properties + + +class DeploymentWhatIf(_serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to server. + + :ivar location: The location to store the deployment data. + :vartype location: str + :ivar properties: The deployment properties. Required. + :vartype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfProperties + """ + + _validation = { + "properties": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, + } + + def __init__( + self, *, properties: "_models.DeploymentWhatIfProperties", location: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword location: The location to store the deployment data. + :paramtype location: str + :keyword properties: The deployment properties. Required. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfProperties + """ + super().__init__(**kwargs) + self.location = location + self.properties = properties + + +class DeploymentWhatIfProperties(DeploymentProperties): + """Deployment What-if properties. + + All required parameters must be populated in order to send to server. + + :ivar template: The template content. You use this element when you want to pass the template + syntax directly in the request rather than link to an existing template. It can be a JObject or + well-formed JSON string. Use either the templateLink property or the template property, but not + both. + :vartype template: JSON + :ivar template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :vartype template_link: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateLink + :ivar parameters: Name and value pairs that define the deployment parameters for the template. + You use this element when you want to provide the parameter values directly in the request + rather than link to an existing parameter file. Use either the parametersLink property or the + parameters property, but not both. It can be a JObject or a well formed JSON string. + :vartype parameters: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentParameter] + :ivar parameters_link: The URI of parameters file. You use this element to link to an existing + parameters file. Use either the parametersLink property or the parameters property, but not + both. + :vartype parameters_link: ~azure.mgmt.resource.resources.v2025_03_01.models.ParametersLink + :ivar extension_configs: The configurations to use for deployment extensions. The keys of this + object are deployment extension aliases as defined in the deployment template. + :vartype extension_configs: dict[str, dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionConfigItem]] + :ivar mode: The mode that is used to deploy resources. This value can be either Incremental or + Complete. In Incremental mode, resources are deployed without deleting existing resources that + are not included in the template. In Complete mode, resources are deployed and existing + resources in the resource group that are not included in the template are deleted. Be careful + when using Complete mode as you may unintentionally delete resources. Required. Known values + are: "Incremental" and "Complete". + :vartype mode: str or ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentMode + :ivar debug_setting: The debug setting of the deployment. + :vartype debug_setting: ~azure.mgmt.resource.resources.v2025_03_01.models.DebugSetting + :ivar on_error_deployment: The deployment on error behavior. + :vartype on_error_deployment: + ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeployment + :ivar expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :vartype expression_evaluation_options: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptions + :ivar validation_level: The validation level of the deployment. Known values are: "Template", + "Provider", and "ProviderNoRbac". + :vartype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + :ivar what_if_settings: Optional What-If operation settings. + :vartype what_if_settings: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfSettings + """ + + _validation = { + "mode": {"required": True}, + } + + _attribute_map = { + "template": {"key": "template", "type": "object"}, + "template_link": {"key": "templateLink", "type": "TemplateLink"}, + "parameters": {"key": "parameters", "type": "{DeploymentParameter}"}, + "parameters_link": {"key": "parametersLink", "type": "ParametersLink"}, + "extension_configs": {"key": "extensionConfigs", "type": "{{DeploymentExtensionConfigItem}}"}, + "mode": {"key": "mode", "type": "str"}, + "debug_setting": {"key": "debugSetting", "type": "DebugSetting"}, + "on_error_deployment": {"key": "onErrorDeployment", "type": "OnErrorDeployment"}, + "expression_evaluation_options": {"key": "expressionEvaluationOptions", "type": "ExpressionEvaluationOptions"}, + "validation_level": {"key": "validationLevel", "type": "str"}, + "what_if_settings": {"key": "whatIfSettings", "type": "DeploymentWhatIfSettings"}, + } + + def __init__( + self, + *, + mode: Union[str, "_models.DeploymentMode"], + template: Optional[JSON] = None, + template_link: Optional["_models.TemplateLink"] = None, + parameters: Optional[Dict[str, "_models.DeploymentParameter"]] = None, + parameters_link: Optional["_models.ParametersLink"] = None, + extension_configs: Optional[Dict[str, Dict[str, "_models.DeploymentExtensionConfigItem"]]] = None, + debug_setting: Optional["_models.DebugSetting"] = None, + on_error_deployment: Optional["_models.OnErrorDeployment"] = None, + expression_evaluation_options: Optional["_models.ExpressionEvaluationOptions"] = None, + validation_level: Optional[Union[str, "_models.ValidationLevel"]] = None, + what_if_settings: Optional["_models.DeploymentWhatIfSettings"] = None, + **kwargs: Any + ) -> None: + """ + :keyword template: The template content. You use this element when you want to pass the + template syntax directly in the request rather than link to an existing template. It can be a + JObject or well-formed JSON string. Use either the templateLink property or the template + property, but not both. + :paramtype template: JSON + :keyword template_link: The URI of the template. Use either the templateLink property or the + template property, but not both. + :paramtype template_link: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateLink + :keyword parameters: Name and value pairs that define the deployment parameters for the + template. You use this element when you want to provide the parameter values directly in the + request rather than link to an existing parameter file. Use either the parametersLink property + or the parameters property, but not both. It can be a JObject or a well formed JSON string. + :paramtype parameters: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentParameter] + :keyword parameters_link: The URI of parameters file. You use this element to link to an + existing parameters file. Use either the parametersLink property or the parameters property, + but not both. + :paramtype parameters_link: ~azure.mgmt.resource.resources.v2025_03_01.models.ParametersLink + :keyword extension_configs: The configurations to use for deployment extensions. The keys of + this object are deployment extension aliases as defined in the deployment template. + :paramtype extension_configs: dict[str, dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionConfigItem]] + :keyword mode: The mode that is used to deploy resources. This value can be either Incremental + or Complete. In Incremental mode, resources are deployed without deleting existing resources + that are not included in the template. In Complete mode, resources are deployed and existing + resources in the resource group that are not included in the template are deleted. Be careful + when using Complete mode as you may unintentionally delete resources. Required. Known values + are: "Incremental" and "Complete". + :paramtype mode: str or ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentMode + :keyword debug_setting: The debug setting of the deployment. + :paramtype debug_setting: ~azure.mgmt.resource.resources.v2025_03_01.models.DebugSetting + :keyword on_error_deployment: The deployment on error behavior. + :paramtype on_error_deployment: + ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeployment + :keyword expression_evaluation_options: Specifies whether template expressions are evaluated + within the scope of the parent template or nested template. Only applicable to nested + templates. If not specified, default value is outer. + :paramtype expression_evaluation_options: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptions + :keyword validation_level: The validation level of the deployment. Known values are: + "Template", "Provider", and "ProviderNoRbac". + :paramtype validation_level: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ValidationLevel + :keyword what_if_settings: Optional What-If operation settings. + :paramtype what_if_settings: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfSettings + """ + super().__init__( + template=template, + template_link=template_link, + parameters=parameters, + parameters_link=parameters_link, + extension_configs=extension_configs, + mode=mode, + debug_setting=debug_setting, + on_error_deployment=on_error_deployment, + expression_evaluation_options=expression_evaluation_options, + validation_level=validation_level, + **kwargs + ) + self.what_if_settings = what_if_settings + + +class DeploymentWhatIfSettings(_serialization.Model): + """Deployment What-If operation settings. + + :ivar result_format: The format of the What-If results. Known values are: "ResourceIdOnly" and + "FullResourcePayloads". + :vartype result_format: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfResultFormat + """ + + _attribute_map = { + "result_format": {"key": "resultFormat", "type": "str"}, + } + + def __init__( + self, *, result_format: Optional[Union[str, "_models.WhatIfResultFormat"]] = None, **kwargs: Any + ) -> None: + """ + :keyword result_format: The format of the What-If results. Known values are: "ResourceIdOnly" + and "FullResourcePayloads". + :paramtype result_format: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfResultFormat + """ + super().__init__(**kwargs) + self.result_format = result_format + + +class ErrorAdditionalInfo(_serialization.Model): + """The resource management error additional info. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: JSON + """ + + _validation = { + "type": {"readonly": True}, + "info": {"readonly": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "info": {"key": "info", "type": "object"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.type: Optional[str] = None + self.info: Optional[JSON] = None + + +class ErrorResponse(_serialization.Model): + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ErrorAdditionalInfo] + """ + + _validation = { + "code": {"readonly": True}, + "message": {"readonly": True}, + "target": {"readonly": True}, + "details": {"readonly": True}, + "additional_info": {"readonly": True}, + } + + _attribute_map = { + "code": {"key": "code", "type": "str"}, + "message": {"key": "message", "type": "str"}, + "target": {"key": "target", "type": "str"}, + "details": {"key": "details", "type": "[ErrorResponse]"}, + "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None + + +class ExportTemplateRequest(_serialization.Model): + """Export resource group template request parameters. + + :ivar resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :vartype resources: list[str] + :ivar options: The export template options. A CSV-formatted list containing zero or more of the + following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :vartype options: str + :ivar output_format: The output format for the exported resources. Known values are: "Json" and + "Bicep". + :vartype output_format: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateOutputFormat + """ + + _attribute_map = { + "resources": {"key": "resources", "type": "[str]"}, + "options": {"key": "options", "type": "str"}, + "output_format": {"key": "outputFormat", "type": "str"}, + } + + def __init__( + self, + *, + resources: Optional[List[str]] = None, + options: Optional[str] = None, + output_format: Optional[Union[str, "_models.ExportTemplateOutputFormat"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resources: The IDs of the resources to filter the export by. To export all resources, + supply an array with single entry '*'. + :paramtype resources: list[str] + :keyword options: The export template options. A CSV-formatted list containing zero or more of + the following: 'IncludeParameterDefaultValue', 'IncludeComments', + 'SkipResourceNameParameterization', 'SkipAllParameterization'. + :paramtype options: str + :keyword output_format: The output format for the exported resources. Known values are: "Json" + and "Bicep". + :paramtype output_format: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateOutputFormat + """ + super().__init__(**kwargs) + self.resources = resources + self.options = options + self.output_format = output_format + + +class ExpressionEvaluationOptions(_serialization.Model): + """Specifies whether template expressions are evaluated within the scope of the parent template or + nested template. + + :ivar scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Known values are: "NotSpecified", "Outer", and "Inner". + :vartype scope: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptionsScopeType + """ + + _attribute_map = { + "scope": {"key": "scope", "type": "str"}, + } + + def __init__( + self, *, scope: Optional[Union[str, "_models.ExpressionEvaluationOptionsScopeType"]] = None, **kwargs: Any + ) -> None: + """ + :keyword scope: The scope to be used for evaluation of parameters, variables and functions in a + nested template. Known values are: "NotSpecified", "Outer", and "Inner". + :paramtype scope: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ExpressionEvaluationOptionsScopeType + """ + super().__init__(**kwargs) + self.scope = scope + + +class ExtendedLocation(_serialization.Model): + """Resource extended location. + + :ivar type: The extended location type. "EdgeZone" + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocationType + :ivar name: The extended location name. + :vartype name: str + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "name": {"key": "name", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ExtendedLocationType"]] = None, + name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The extended location type. "EdgeZone" + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocationType + :keyword name: The extended location name. + :paramtype name: str + """ + super().__init__(**kwargs) + self.type = type + self.name = name + + +class Resource(_serialization.Model): + """Specified resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar extended_location: Resource extended location. + :vartype extended_location: ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword extended_location: Resource extended location. + :paramtype extended_location: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.location = location + self.extended_location = extended_location + self.tags = tags + + +class GenericResource(Resource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar extended_location: Resource extended location. + :vartype extended_location: ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar plan: The plan of the resource. + :vartype plan: ~azure.mgmt.resource.resources.v2025_03_01.models.Plan + :ivar properties: The resource properties. + :vartype properties: JSON + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.resource.resources.v2025_03_01.models.Sku + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.resource.resources.v2025_03_01.models.Identity + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "Plan"}, + "properties": {"key": "properties", "type": "object"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "Identity"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["_models.Plan"] = None, + properties: Optional[JSON] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + identity: Optional["_models.Identity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword extended_location: Resource extended location. + :paramtype extended_location: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword plan: The plan of the resource. + :paramtype plan: ~azure.mgmt.resource.resources.v2025_03_01.models.Plan + :keyword properties: The resource properties. + :paramtype properties: JSON + :keyword kind: The kind of the resource. + :paramtype kind: str + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.resource.resources.v2025_03_01.models.Sku + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.resource.resources.v2025_03_01.models.Identity + """ + super().__init__(location=location, extended_location=extended_location, tags=tags, **kwargs) + self.plan = plan + self.properties = properties + self.kind = kind + self.managed_by = managed_by + self.sku = sku + self.identity = identity + + +class GenericResourceExpanded(GenericResource): + """Resource information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Resource ID. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar location: Resource location. + :vartype location: str + :ivar extended_location: Resource extended location. + :vartype extended_location: ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar plan: The plan of the resource. + :vartype plan: ~azure.mgmt.resource.resources.v2025_03_01.models.Plan + :ivar properties: The resource properties. + :vartype properties: JSON + :ivar kind: The kind of the resource. + :vartype kind: str + :ivar managed_by: ID of the resource that manages this resource. + :vartype managed_by: str + :ivar sku: The SKU of the resource. + :vartype sku: ~azure.mgmt.resource.resources.v2025_03_01.models.Sku + :ivar identity: The identity of the resource. + :vartype identity: ~azure.mgmt.resource.resources.v2025_03_01.models.Identity + :ivar created_time: The created time of the resource. This is only present if requested via the + $expand query parameter. + :vartype created_time: ~datetime.datetime + :ivar changed_time: The changed time of the resource. This is only present if requested via the + $expand query parameter. + :vartype changed_time: ~datetime.datetime + :ivar provisioning_state: The provisioning state of the resource. This is only present if + requested via the $expand query parameter. + :vartype provisioning_state: str + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "kind": {"pattern": r"^[-\w\._,\(\)]+$"}, + "created_time": {"readonly": True}, + "changed_time": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "location": {"key": "location", "type": "str"}, + "extended_location": {"key": "extendedLocation", "type": "ExtendedLocation"}, + "tags": {"key": "tags", "type": "{str}"}, + "plan": {"key": "plan", "type": "Plan"}, + "properties": {"key": "properties", "type": "object"}, + "kind": {"key": "kind", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "sku": {"key": "sku", "type": "Sku"}, + "identity": {"key": "identity", "type": "Identity"}, + "created_time": {"key": "createdTime", "type": "iso-8601"}, + "changed_time": {"key": "changedTime", "type": "iso-8601"}, + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + tags: Optional[Dict[str, str]] = None, + plan: Optional["_models.Plan"] = None, + properties: Optional[JSON] = None, + kind: Optional[str] = None, + managed_by: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + identity: Optional["_models.Identity"] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: Resource location. + :paramtype location: str + :keyword extended_location: Resource extended location. + :paramtype extended_location: + ~azure.mgmt.resource.resources.v2025_03_01.models.ExtendedLocation + :keyword tags: Resource tags. + :paramtype tags: dict[str, str] + :keyword plan: The plan of the resource. + :paramtype plan: ~azure.mgmt.resource.resources.v2025_03_01.models.Plan + :keyword properties: The resource properties. + :paramtype properties: JSON + :keyword kind: The kind of the resource. + :paramtype kind: str + :keyword managed_by: ID of the resource that manages this resource. + :paramtype managed_by: str + :keyword sku: The SKU of the resource. + :paramtype sku: ~azure.mgmt.resource.resources.v2025_03_01.models.Sku + :keyword identity: The identity of the resource. + :paramtype identity: ~azure.mgmt.resource.resources.v2025_03_01.models.Identity + """ + super().__init__( + location=location, + extended_location=extended_location, + tags=tags, + plan=plan, + properties=properties, + kind=kind, + managed_by=managed_by, + sku=sku, + identity=identity, + **kwargs + ) + self.created_time: Optional[datetime.datetime] = None + self.changed_time: Optional[datetime.datetime] = None + self.provisioning_state: Optional[str] = None + + +class GenericResourceFilter(_serialization.Model): + """Resource filter. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar tagname: The tag name. + :vartype tagname: str + :ivar tagvalue: The tag value. + :vartype tagvalue: str + """ + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "tagname": {"key": "tagname", "type": "str"}, + "tagvalue": {"key": "tagvalue", "type": "str"}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + tagname: Optional[str] = None, + tagvalue: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_type: The resource type. + :paramtype resource_type: str + :keyword tagname: The tag name. + :paramtype tagname: str + :keyword tagvalue: The tag value. + :paramtype tagvalue: str + """ + super().__init__(**kwargs) + self.resource_type = resource_type + self.tagname = tagname + self.tagvalue = tagvalue + + +class HttpMessage(_serialization.Model): + """HTTP message. + + :ivar content: HTTP message content. + :vartype content: JSON + """ + + _attribute_map = { + "content": {"key": "content", "type": "object"}, + } + + def __init__(self, *, content: Optional[JSON] = None, **kwargs: Any) -> None: + """ + :keyword content: HTTP message content. + :paramtype content: JSON + """ + super().__init__(**kwargs) + self.content = content + + +class Identity(_serialization.Model): + """Identity 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 resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :ivar type: The identity type. Known values are: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The + user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.IdentityUserAssignedIdentitiesValue] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{IdentityUserAssignedIdentitiesValue}"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.IdentityUserAssignedIdentitiesValue"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", and "None". + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.resource.resources.v2025_03_01.models.IdentityUserAssignedIdentitiesValue] + """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class IdentityUserAssignedIdentitiesValue(_serialization.Model): + """IdentityUserAssignedIdentitiesValue. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal id of user assigned identity. + :vartype principal_id: str + :ivar client_id: The client id of user assigned 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: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id: Optional[str] = None + self.client_id: Optional[str] = None + + +class KeyVaultParameterReference(_serialization.Model): + """Azure Key Vault parameter reference. + + All required parameters must be populated in order to send to server. + + :ivar key_vault: Azure Key Vault reference. Required. + :vartype key_vault: ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultReference + :ivar secret_name: Azure Key Vault secret name. Required. + :vartype secret_name: str + :ivar secret_version: Azure Key Vault secret version. + :vartype secret_version: str + """ + + _validation = { + "key_vault": {"required": True}, + "secret_name": {"required": True}, + } + + _attribute_map = { + "key_vault": {"key": "keyVault", "type": "KeyVaultReference"}, + "secret_name": {"key": "secretName", "type": "str"}, + "secret_version": {"key": "secretVersion", "type": "str"}, + } + + def __init__( + self, + *, + key_vault: "_models.KeyVaultReference", + secret_name: str, + secret_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword key_vault: Azure Key Vault reference. Required. + :paramtype key_vault: ~azure.mgmt.resource.resources.v2025_03_01.models.KeyVaultReference + :keyword secret_name: Azure Key Vault secret name. Required. + :paramtype secret_name: str + :keyword secret_version: Azure Key Vault secret version. + :paramtype secret_version: str + """ + super().__init__(**kwargs) + self.key_vault = key_vault + self.secret_name = secret_name + self.secret_version = secret_version + + +class KeyVaultReference(_serialization.Model): + """Azure Key Vault reference. + + All required parameters must be populated in order to send to server. + + :ivar id: Azure Key Vault resource id. Required. + :vartype id: str + """ + + _validation = { + "id": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Azure Key Vault resource id. Required. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class OnErrorDeployment(_serialization.Model): + """Deployment on error behavior. + + :ivar type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeploymentType + :ivar deployment_name: The deployment to be used on error case. + :vartype deployment_name: str + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "deployment_name": {"key": "deploymentName", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeploymentType + :keyword deployment_name: The deployment to be used on error case. + :paramtype deployment_name: str + """ + super().__init__(**kwargs) + self.type = type + self.deployment_name = deployment_name + + +class OnErrorDeploymentExtended(_serialization.Model): + """Deployment on error behavior with additional details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The state of the provisioning for the on error deployment. + :vartype provisioning_state: str + :ivar type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". + :vartype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeploymentType + :ivar deployment_name: The deployment to be used on error case. + :vartype deployment_name: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "deployment_name": {"key": "deploymentName", "type": "str"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.OnErrorDeploymentType"]] = None, + deployment_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. Known values are: "LastSuccessful" and "SpecificDeployment". + :paramtype type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.OnErrorDeploymentType + :keyword deployment_name: The deployment to be used on error case. + :paramtype deployment_name: str + """ + super().__init__(**kwargs) + self.provisioning_state: Optional[str] = None + self.type = type + self.deployment_name = deployment_name + + +class Operation(_serialization.Model): + """Microsoft.Resources operation. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.resource.resources.v2025_03_01.models.OperationDisplay + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "display": {"key": "display", "type": "OperationDisplay"}, + } + + def __init__( + self, *, name: Optional[str] = None, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any + ) -> None: + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.resource.resources.v2025_03_01.models.OperationDisplay + """ + super().__init__(**kwargs) + self.name = name + self.display = display + + +class OperationDisplay(_serialization.Model): + """The object that represents the operation. + + :ivar provider: Service provider: Microsoft.Resources. + :vartype provider: str + :ivar resource: Resource on which the operation is performed: Profile, endpoint, etc. + :vartype resource: str + :ivar operation: Operation type: Read, write, 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: Any + ) -> None: + """ + :keyword provider: Service provider: Microsoft.Resources. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed: Profile, endpoint, etc. + :paramtype resource: str + :keyword operation: Operation type: Read, write, delete, etc. + :paramtype operation: str + :keyword description: Description of the operation. + :paramtype description: str + """ + super().__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(_serialization.Model): + """Result of the request to list Microsoft.Resources operations. It contains a list of operations + and a URL link to get the next set of results. + + :ivar value: List of Microsoft.Resources operations. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.Operation] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[Operation]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of Microsoft.Resources operations. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.Operation] + :keyword next_link: URL to get the next set of operation list results if there are any. + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ParametersLink(_serialization.Model): + """Entity representing the reference to the deployment parameters. + + All required parameters must be populated in order to send to server. + + :ivar uri: The URI of the parameters file. Required. + :vartype uri: str + :ivar content_version: If included, must match the ContentVersion in the template. + :vartype content_version: str + """ + + _validation = { + "uri": {"required": True}, + } + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + "content_version": {"key": "contentVersion", "type": "str"}, + } + + def __init__(self, *, uri: str, content_version: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword uri: The URI of the parameters file. Required. + :paramtype uri: str + :keyword content_version: If included, must match the ContentVersion in the template. + :paramtype content_version: str + """ + super().__init__(**kwargs) + self.uri = uri + self.content_version = content_version + + +class Permission(_serialization.Model): + """Role definition permissions. + + :ivar actions: Allowed actions. + :vartype actions: list[str] + :ivar not_actions: Denied actions. + :vartype not_actions: list[str] + :ivar data_actions: Allowed Data actions. + :vartype data_actions: list[str] + :ivar not_data_actions: Denied Data actions. + :vartype not_data_actions: list[str] + """ + + _attribute_map = { + "actions": {"key": "actions", "type": "[str]"}, + "not_actions": {"key": "notActions", "type": "[str]"}, + "data_actions": {"key": "dataActions", "type": "[str]"}, + "not_data_actions": {"key": "notDataActions", "type": "[str]"}, + } + + def __init__( + self, + *, + actions: Optional[List[str]] = None, + not_actions: Optional[List[str]] = None, + data_actions: Optional[List[str]] = None, + not_data_actions: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword actions: Allowed actions. + :paramtype actions: list[str] + :keyword not_actions: Denied actions. + :paramtype not_actions: list[str] + :keyword data_actions: Allowed Data actions. + :paramtype data_actions: list[str] + :keyword not_data_actions: Denied Data actions. + :paramtype not_data_actions: list[str] + """ + super().__init__(**kwargs) + self.actions = actions + self.not_actions = not_actions + self.data_actions = data_actions + self.not_data_actions = not_data_actions + + +class Plan(_serialization.Model): + """Plan for the resource. + + :ivar name: The plan ID. + :vartype name: str + :ivar publisher: The publisher ID. + :vartype publisher: str + :ivar product: The offer ID. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + :ivar version: The plan's version. + :vartype version: str + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "product": {"key": "product", "type": "str"}, + "promotion_code": {"key": "promotionCode", "type": "str"}, + "version": {"key": "version", "type": "str"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + publisher: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The plan ID. + :paramtype name: str + :keyword publisher: The publisher ID. + :paramtype publisher: str + :keyword product: The offer ID. + :paramtype product: str + :keyword promotion_code: The promotion code. + :paramtype promotion_code: str + :keyword version: The plan's version. + :paramtype version: str + """ + super().__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class Provider(_serialization.Model): + """Resource provider information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The provider ID. + :vartype id: str + :ivar namespace: The namespace of the resource provider. + :vartype namespace: str + :ivar registration_state: The registration state of the resource provider. + :vartype registration_state: str + :ivar registration_policy: The registration policy of the resource provider. + :vartype registration_policy: str + :ivar resource_types: The collection of provider resource types. + :vartype resource_types: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderResourceType] + :ivar provider_authorization_consent_state: The provider authorization consent state. Known + values are: "NotSpecified", "Required", "NotRequired", and "Consented". + :vartype provider_authorization_consent_state: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderAuthorizationConsentState + """ + + _validation = { + "id": {"readonly": True}, + "registration_state": {"readonly": True}, + "registration_policy": {"readonly": True}, + "resource_types": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "namespace": {"key": "namespace", "type": "str"}, + "registration_state": {"key": "registrationState", "type": "str"}, + "registration_policy": {"key": "registrationPolicy", "type": "str"}, + "resource_types": {"key": "resourceTypes", "type": "[ProviderResourceType]"}, + "provider_authorization_consent_state": {"key": "providerAuthorizationConsentState", "type": "str"}, + } + + def __init__( + self, + *, + namespace: Optional[str] = None, + provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword namespace: The namespace of the resource provider. + :paramtype namespace: str + :keyword provider_authorization_consent_state: The provider authorization consent state. Known + values are: "NotSpecified", "Required", "NotRequired", and "Consented". + :paramtype provider_authorization_consent_state: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderAuthorizationConsentState + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.namespace = namespace + self.registration_state: Optional[str] = None + self.registration_policy: Optional[str] = None + self.resource_types: Optional[List["_models.ProviderResourceType"]] = None + self.provider_authorization_consent_state = provider_authorization_consent_state + + +class ProviderConsentDefinition(_serialization.Model): + """The provider consent. + + :ivar consent_to_authorization: A value indicating whether authorization is consented or not. + :vartype consent_to_authorization: bool + """ + + _attribute_map = { + "consent_to_authorization": {"key": "consentToAuthorization", "type": "bool"}, + } + + def __init__(self, *, consent_to_authorization: Optional[bool] = None, **kwargs: Any) -> None: + """ + :keyword consent_to_authorization: A value indicating whether authorization is consented or + not. + :paramtype consent_to_authorization: bool + """ + super().__init__(**kwargs) + self.consent_to_authorization = consent_to_authorization + + +class ProviderExtendedLocation(_serialization.Model): + """The provider extended location. + + :ivar location: The azure location. + :vartype location: str + :ivar type: The extended location type. + :vartype type: str + :ivar extended_locations: The extended locations for the azure location. + :vartype extended_locations: list[str] + """ + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "extended_locations": {"key": "extendedLocations", "type": "[str]"}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + type: Optional[str] = None, + extended_locations: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The azure location. + :paramtype location: str + :keyword type: The extended location type. + :paramtype type: str + :keyword extended_locations: The extended locations for the azure location. + :paramtype extended_locations: list[str] + """ + super().__init__(**kwargs) + self.location = location + self.type = type + self.extended_locations = extended_locations + + +class ProviderListResult(_serialization.Model): + """List of resource providers. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of resource providers. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[Provider]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.Provider"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of resource providers. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ProviderPermission(_serialization.Model): + """The provider permission. + + :ivar application_id: The application id. + :vartype application_id: str + :ivar role_definition: Role definition properties. + :vartype role_definition: ~azure.mgmt.resource.resources.v2025_03_01.models.RoleDefinition + :ivar managed_by_role_definition: Role definition properties. + :vartype managed_by_role_definition: + ~azure.mgmt.resource.resources.v2025_03_01.models.RoleDefinition + :ivar provider_authorization_consent_state: The provider authorization consent state. Known + values are: "NotSpecified", "Required", "NotRequired", and "Consented". + :vartype provider_authorization_consent_state: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderAuthorizationConsentState + """ + + _attribute_map = { + "application_id": {"key": "applicationId", "type": "str"}, + "role_definition": {"key": "roleDefinition", "type": "RoleDefinition"}, + "managed_by_role_definition": {"key": "managedByRoleDefinition", "type": "RoleDefinition"}, + "provider_authorization_consent_state": {"key": "providerAuthorizationConsentState", "type": "str"}, + } + + def __init__( + self, + *, + application_id: Optional[str] = None, + role_definition: Optional["_models.RoleDefinition"] = None, + managed_by_role_definition: Optional["_models.RoleDefinition"] = None, + provider_authorization_consent_state: Optional[Union[str, "_models.ProviderAuthorizationConsentState"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword application_id: The application id. + :paramtype application_id: str + :keyword role_definition: Role definition properties. + :paramtype role_definition: ~azure.mgmt.resource.resources.v2025_03_01.models.RoleDefinition + :keyword managed_by_role_definition: Role definition properties. + :paramtype managed_by_role_definition: + ~azure.mgmt.resource.resources.v2025_03_01.models.RoleDefinition + :keyword provider_authorization_consent_state: The provider authorization consent state. Known + values are: "NotSpecified", "Required", "NotRequired", and "Consented". + :paramtype provider_authorization_consent_state: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderAuthorizationConsentState + """ + super().__init__(**kwargs) + self.application_id = application_id + self.role_definition = role_definition + self.managed_by_role_definition = managed_by_role_definition + self.provider_authorization_consent_state = provider_authorization_consent_state + + +class ProviderPermissionListResult(_serialization.Model): + """List of provider permissions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of provider permissions. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderPermission] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ProviderPermission]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ProviderPermission"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of provider permissions. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderPermission] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ProviderRegistrationRequest(_serialization.Model): + """The provider registration definition. + + :ivar third_party_provider_consent: The provider consent. + :vartype third_party_provider_consent: + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderConsentDefinition + """ + + _attribute_map = { + "third_party_provider_consent": {"key": "thirdPartyProviderConsent", "type": "ProviderConsentDefinition"}, + } + + def __init__( + self, *, third_party_provider_consent: Optional["_models.ProviderConsentDefinition"] = None, **kwargs: Any + ) -> None: + """ + :keyword third_party_provider_consent: The provider consent. + :paramtype third_party_provider_consent: + ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderConsentDefinition + """ + super().__init__(**kwargs) + self.third_party_provider_consent = third_party_provider_consent + + +class ProviderResourceType(_serialization.Model): + """Resource type managed by the resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar locations: The collection of locations where this resource type can be created. + :vartype locations: list[str] + :ivar location_mappings: The location mappings that are supported by this resource type. + :vartype location_mappings: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderExtendedLocation] + :ivar aliases: The aliases that are supported by this resource type. + :vartype aliases: list[~azure.mgmt.resource.resources.v2025_03_01.models.Alias] + :ivar api_versions: The API version. + :vartype api_versions: list[str] + :ivar default_api_version: The default API version. + :vartype default_api_version: str + :ivar zone_mappings: + :vartype zone_mappings: list[~azure.mgmt.resource.resources.v2025_03_01.models.ZoneMapping] + :ivar api_profiles: The API profiles for the resource provider. + :vartype api_profiles: list[~azure.mgmt.resource.resources.v2025_03_01.models.ApiProfile] + :ivar capabilities: The additional capabilities offered by this resource type. + :vartype capabilities: str + :ivar properties: The properties. + :vartype properties: dict[str, str] + """ + + _validation = { + "default_api_version": {"readonly": True}, + "api_profiles": {"readonly": True}, + } + + _attribute_map = { + "resource_type": {"key": "resourceType", "type": "str"}, + "locations": {"key": "locations", "type": "[str]"}, + "location_mappings": {"key": "locationMappings", "type": "[ProviderExtendedLocation]"}, + "aliases": {"key": "aliases", "type": "[Alias]"}, + "api_versions": {"key": "apiVersions", "type": "[str]"}, + "default_api_version": {"key": "defaultApiVersion", "type": "str"}, + "zone_mappings": {"key": "zoneMappings", "type": "[ZoneMapping]"}, + "api_profiles": {"key": "apiProfiles", "type": "[ApiProfile]"}, + "capabilities": {"key": "capabilities", "type": "str"}, + "properties": {"key": "properties", "type": "{str}"}, + } + + def __init__( + self, + *, + resource_type: Optional[str] = None, + locations: Optional[List[str]] = None, + location_mappings: Optional[List["_models.ProviderExtendedLocation"]] = None, + aliases: Optional[List["_models.Alias"]] = None, + api_versions: Optional[List[str]] = None, + zone_mappings: Optional[List["_models.ZoneMapping"]] = None, + capabilities: Optional[str] = None, + properties: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_type: The resource type. + :paramtype resource_type: str + :keyword locations: The collection of locations where this resource type can be created. + :paramtype locations: list[str] + :keyword location_mappings: The location mappings that are supported by this resource type. + :paramtype location_mappings: + list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderExtendedLocation] + :keyword aliases: The aliases that are supported by this resource type. + :paramtype aliases: list[~azure.mgmt.resource.resources.v2025_03_01.models.Alias] + :keyword api_versions: The API version. + :paramtype api_versions: list[str] + :keyword zone_mappings: + :paramtype zone_mappings: list[~azure.mgmt.resource.resources.v2025_03_01.models.ZoneMapping] + :keyword capabilities: The additional capabilities offered by this resource type. + :paramtype capabilities: str + :keyword properties: The properties. + :paramtype properties: dict[str, str] + """ + super().__init__(**kwargs) + self.resource_type = resource_type + self.locations = locations + self.location_mappings = location_mappings + self.aliases = aliases + self.api_versions = api_versions + self.default_api_version: Optional[str] = None + self.zone_mappings = zone_mappings + self.api_profiles: Optional[List["_models.ApiProfile"]] = None + self.capabilities = capabilities + self.properties = properties + + +class ProviderResourceTypeListResult(_serialization.Model): + """List of resource types of a resource provider. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of resource types. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderResourceType] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ProviderResourceType]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ProviderResourceType"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of resource types. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ProviderResourceType] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ResourceGroup(_serialization.Model): + """Resource group information. + + 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 server. + + :ivar id: The ID of the resource group. + :vartype id: str + :ivar name: The name of the resource group. + :vartype name: str + :ivar type: The type of the resource group. + :vartype type: str + :ivar properties: The resource group properties. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupProperties + :ivar location: The location of the resource group. It cannot be changed after the resource + group has been created. It must be one of the supported Azure locations. Required. + :vartype location: str + :ivar managed_by: The ID of the resource that manages this resource group. + :vartype managed_by: str + :ivar tags: The tags attached to the resource group. + :vartype tags: dict[str, 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"}, + "properties": {"key": "properties", "type": "ResourceGroupProperties"}, + "location": {"key": "location", "type": "str"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + location: str, + properties: Optional["_models.ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword properties: The resource group properties. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupProperties + :keyword location: The location of the resource group. It cannot be changed after the resource + group has been created. It must be one of the supported Azure locations. Required. + :paramtype location: str + :keyword managed_by: The ID of the resource that manages this resource group. + :paramtype managed_by: str + :keyword tags: The tags attached to the resource group. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.properties = properties + self.location = location + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupExportResult(_serialization.Model): + """Resource group export result. + + :ivar template: The template content. Used if outputFormat is empty or set to 'Json'. + :vartype template: JSON + :ivar output: The formatted export content. Used if outputFormat is set to 'Bicep'. + :vartype output: str + :ivar error: The template export error. + :vartype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + """ + + _attribute_map = { + "template": {"key": "template", "type": "object"}, + "output": {"key": "output", "type": "str"}, + "error": {"key": "error", "type": "ErrorResponse"}, + } + + def __init__( + self, + *, + template: Optional[JSON] = None, + output: Optional[str] = None, + error: Optional["_models.ErrorResponse"] = None, + **kwargs: Any + ) -> None: + """ + :keyword template: The template content. Used if outputFormat is empty or set to 'Json'. + :paramtype template: JSON + :keyword output: The formatted export content. Used if outputFormat is set to 'Bicep'. + :paramtype output: str + :keyword error: The template export error. + :paramtype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + """ + super().__init__(**kwargs) + self.template = template + self.output = output + self.error = error + + +class ResourceGroupFilter(_serialization.Model): + """Resource group filter. + + :ivar tag_name: The tag name. + :vartype tag_name: str + :ivar tag_value: The tag value. + :vartype tag_value: str + """ + + _attribute_map = { + "tag_name": {"key": "tagName", "type": "str"}, + "tag_value": {"key": "tagValue", "type": "str"}, + } + + def __init__(self, *, tag_name: Optional[str] = None, tag_value: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword tag_name: The tag name. + :paramtype tag_name: str + :keyword tag_value: The tag value. + :paramtype tag_value: str + """ + super().__init__(**kwargs) + self.tag_name = tag_name + self.tag_value = tag_value + + +class ResourceGroupListResult(_serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of resource groups. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[ResourceGroup]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.ResourceGroup"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of resource groups. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ResourceGroupPatchable(_serialization.Model): + """Resource group information. + + :ivar name: The name of the resource group. + :vartype name: str + :ivar properties: The resource group properties. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupProperties + :ivar managed_by: The ID of the resource that manages this resource group. + :vartype managed_by: str + :ivar tags: The tags attached to the resource group. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "properties": {"key": "properties", "type": "ResourceGroupProperties"}, + "managed_by": {"key": "managedBy", "type": "str"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + properties: Optional["_models.ResourceGroupProperties"] = None, + managed_by: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the resource group. + :paramtype name: str + :keyword properties: The resource group properties. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupProperties + :keyword managed_by: The ID of the resource that manages this resource group. + :paramtype managed_by: str + :keyword tags: The tags attached to the resource group. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.name = name + self.properties = properties + self.managed_by = managed_by + self.tags = tags + + +class ResourceGroupProperties(_serialization.Model): + """The resource group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: The provisioning state. + :vartype provisioning_state: str + """ + + _validation = { + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "provisioning_state": {"key": "provisioningState", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.provisioning_state: Optional[str] = None + + +class ResourceListResult(_serialization.Model): + """List of resource groups. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of resources. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[GenericResourceExpanded]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.GenericResourceExpanded"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of resources. + :paramtype value: + list[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class ResourceProviderOperationDisplayProperties(_serialization.Model): # pylint: disable=name-too-long + """Resource provider operation's display properties. + + :ivar publisher: Operation description. + :vartype publisher: str + :ivar provider: Operation provider. + :vartype provider: str + :ivar resource: Operation resource. + :vartype resource: str + :ivar operation: Resource provider operation. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str + """ + + _attribute_map = { + "publisher": {"key": "publisher", "type": "str"}, + "provider": {"key": "provider", "type": "str"}, + "resource": {"key": "resource", "type": "str"}, + "operation": {"key": "operation", "type": "str"}, + "description": {"key": "description", "type": "str"}, + } + + def __init__( + self, + *, + publisher: Optional[str] = None, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword publisher: Operation description. + :paramtype publisher: str + :keyword provider: Operation provider. + :paramtype provider: str + :keyword resource: Operation resource. + :paramtype resource: str + :keyword operation: Resource provider operation. + :paramtype operation: str + :keyword description: Operation description. + :paramtype description: str + """ + super().__init__(**kwargs) + self.publisher = publisher + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceReference(_serialization.Model): + """The resource Id model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The fully qualified Azure resource ID. + :vartype id: str + :ivar extension: The key of the extension the resource was deployed with. + :vartype extension: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionDefinition + :ivar resource_type: The resource type. + :vartype resource_type: str + :ivar identifiers: The extensible resource identifiers. + :vartype identifiers: JSON + :ivar api_version: The API version the resource was deployed with. + :vartype api_version: str + """ + + _validation = { + "id": {"readonly": True}, + "extension": {"readonly": True}, + "resource_type": {"readonly": True}, + "identifiers": {"readonly": True}, + "api_version": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "extension": {"key": "extension", "type": "DeploymentExtensionDefinition"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "identifiers": {"key": "identifiers", "type": "object"}, + "api_version": {"key": "apiVersion", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.extension: Optional["_models.DeploymentExtensionDefinition"] = None + self.resource_type: Optional[str] = None + self.identifiers: Optional[JSON] = None + self.api_version: Optional[str] = None + + +class ResourcesMoveInfo(_serialization.Model): + """Parameters of move resources. + + :ivar resources: The IDs of the resources. + :vartype resources: list[str] + :ivar target_resource_group: The target resource group. + :vartype target_resource_group: str + """ + + _attribute_map = { + "resources": {"key": "resources", "type": "[str]"}, + "target_resource_group": {"key": "targetResourceGroup", "type": "str"}, + } + + def __init__( + self, *, resources: Optional[List[str]] = None, target_resource_group: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword resources: The IDs of the resources. + :paramtype resources: list[str] + :keyword target_resource_group: The target resource group. + :paramtype target_resource_group: str + """ + super().__init__(**kwargs) + self.resources = resources + self.target_resource_group = target_resource_group + + +class RoleDefinition(_serialization.Model): + """Role definition properties. + + :ivar id: The role definition ID. + :vartype id: str + :ivar name: The role definition name. + :vartype name: str + :ivar is_service_role: If this is a service role. + :vartype is_service_role: bool + :ivar permissions: Role definition permissions. + :vartype permissions: list[~azure.mgmt.resource.resources.v2025_03_01.models.Permission] + :ivar scopes: Role definition assignable scopes. + :vartype scopes: list[str] + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "is_service_role": {"key": "isServiceRole", "type": "bool"}, + "permissions": {"key": "permissions", "type": "[Permission]"}, + "scopes": {"key": "scopes", "type": "[str]"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + is_service_role: Optional[bool] = None, + permissions: Optional[List["_models.Permission"]] = None, + scopes: Optional[List[str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The role definition ID. + :paramtype id: str + :keyword name: The role definition name. + :paramtype name: str + :keyword is_service_role: If this is a service role. + :paramtype is_service_role: bool + :keyword permissions: Role definition permissions. + :paramtype permissions: list[~azure.mgmt.resource.resources.v2025_03_01.models.Permission] + :keyword scopes: Role definition assignable scopes. + :paramtype scopes: list[str] + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.is_service_role = is_service_role + self.permissions = permissions + self.scopes = scopes + + +class ScopedDeployment(_serialization.Model): + """Deployment operation parameters. + + All required parameters must be populated in order to send to server. + + :ivar location: The location to store the deployment data. Required. + :vartype location: str + :ivar properties: The deployment properties. Required. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentProperties + :ivar tags: Deployment tags. + :vartype tags: dict[str, str] + """ + + _validation = { + "location": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentProperties"}, + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.DeploymentProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs: Any + ) -> None: + """ + :keyword location: The location to store the deployment data. Required. + :paramtype location: str + :keyword properties: The deployment properties. Required. + :paramtype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentProperties + :keyword tags: Deployment tags. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.location = location + self.properties = properties + self.tags = tags + + +class ScopedDeploymentWhatIf(_serialization.Model): + """Deployment What-if operation parameters. + + All required parameters must be populated in order to send to server. + + :ivar location: The location to store the deployment data. Required. + :vartype location: str + :ivar properties: The deployment properties. Required. + :vartype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfProperties + """ + + _validation = { + "location": {"required": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "properties": {"key": "properties", "type": "DeploymentWhatIfProperties"}, + } + + def __init__(self, *, location: str, properties: "_models.DeploymentWhatIfProperties", **kwargs: Any) -> None: + """ + :keyword location: The location to store the deployment data. Required. + :paramtype location: str + :keyword properties: The deployment properties. Required. + :paramtype properties: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIfProperties + """ + super().__init__(**kwargs) + self.location = location + self.properties = properties + + +class Sku(_serialization.Model): + """SKU for the resource. + + :ivar name: The SKU name. + :vartype name: str + :ivar tier: The SKU tier. + :vartype tier: str + :ivar size: The SKU size. + :vartype size: str + :ivar family: The SKU family. + :vartype family: str + :ivar model: The SKU model. + :vartype model: str + :ivar capacity: The SKU capacity. + :vartype capacity: int + """ + + _attribute_map = { + "name": {"key": "name", "type": "str"}, + "tier": {"key": "tier", "type": "str"}, + "size": {"key": "size", "type": "str"}, + "family": {"key": "family", "type": "str"}, + "model": {"key": "model", "type": "str"}, + "capacity": {"key": "capacity", "type": "int"}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + tier: Optional[str] = None, + size: Optional[str] = None, + family: Optional[str] = None, + model: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The SKU name. + :paramtype name: str + :keyword tier: The SKU tier. + :paramtype tier: str + :keyword size: The SKU size. + :paramtype size: str + :keyword family: The SKU family. + :paramtype family: str + :keyword model: The SKU model. + :paramtype model: str + :keyword capacity: The SKU capacity. + :paramtype capacity: int + """ + super().__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.model = model + self.capacity = capacity + + +class StatusMessage(_serialization.Model): + """Operation status message object. + + :ivar status: Status of the deployment operation. + :vartype status: str + :ivar error: The error reported by the operation. + :vartype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + """ + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "ErrorResponse"}, + } + + def __init__( + self, *, status: Optional[str] = None, error: Optional["_models.ErrorResponse"] = None, **kwargs: Any + ) -> None: + """ + :keyword status: Status of the deployment operation. + :paramtype status: str + :keyword error: The error reported by the operation. + :paramtype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + """ + super().__init__(**kwargs) + self.status = status + self.error = error + + +class SubResource(_serialization.Model): + """Sub-resource. + + :ivar id: Resource ID. + :vartype id: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + } + + def __init__(self, *, id: Optional[str] = None, **kwargs: Any) -> None: # pylint: disable=redefined-builtin + """ + :keyword id: Resource ID. + :paramtype id: str + """ + super().__init__(**kwargs) + self.id = id + + +class TagCount(_serialization.Model): + """Tag count. + + :ivar type: Type of count. + :vartype type: str + :ivar value: Value of count. + :vartype value: int + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + "value": {"key": "value", "type": "int"}, + } + + def __init__(self, *, type: Optional[str] = None, value: Optional[int] = None, **kwargs: Any) -> None: + """ + :keyword type: Type of count. + :paramtype type: str + :keyword value: Value of count. + :paramtype value: int + """ + super().__init__(**kwargs) + self.type = type + self.value = value + + +class TagDetails(_serialization.Model): + """Tag details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag name ID. + :vartype id: str + :ivar tag_name: The tag name. + :vartype tag_name: str + :ivar count: The total number of resources that use the resource tag. When a tag is initially + created and has no associated resources, the value is 0. + :vartype count: ~azure.mgmt.resource.resources.v2025_03_01.models.TagCount + :ivar values: The list of tag values. + :vartype values: list[~azure.mgmt.resource.resources.v2025_03_01.models.TagValue] + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "tag_name": {"key": "tagName", "type": "str"}, + "count": {"key": "count", "type": "TagCount"}, + "values": {"key": "values", "type": "[TagValue]"}, + } + + def __init__( + self, + *, + tag_name: Optional[str] = None, + count: Optional["_models.TagCount"] = None, + values: Optional[List["_models.TagValue"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword tag_name: The tag name. + :paramtype tag_name: str + :keyword count: The total number of resources that use the resource tag. When a tag is + initially created and has no associated resources, the value is 0. + :paramtype count: ~azure.mgmt.resource.resources.v2025_03_01.models.TagCount + :keyword values: The list of tag values. + :paramtype values: list[~azure.mgmt.resource.resources.v2025_03_01.models.TagValue] + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.tag_name = tag_name + self.count = count + self.values = values + + +class Tags(_serialization.Model): + """A dictionary of name and value pairs. + + :ivar tags: Dictionary of :code:``. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + "tags": {"key": "tags", "type": "{str}"}, + } + + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: + """ + :keyword tags: Dictionary of :code:``. + :paramtype tags: dict[str, str] + """ + super().__init__(**kwargs) + self.tags = tags + + +class TagsListResult(_serialization.Model): + """List of subscription tags. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: An array of tags. + :vartype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _validation = { + "next_link": {"readonly": True}, + } + + _attribute_map = { + "value": {"key": "value", "type": "[TagDetails]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.TagDetails"]] = None, **kwargs: Any) -> None: + """ + :keyword value: An array of tags. + :paramtype value: list[~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails] + """ + super().__init__(**kwargs) + self.value = value + self.next_link: Optional[str] = None + + +class TagsPatchResource(_serialization.Model): + """Wrapper resource for tags patch API request only. + + :ivar operation: The operation type for the patch API. Known values are: "Replace", "Merge", + and "Delete". + :vartype operation: str or ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchOperation + :ivar properties: The set of tags. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.Tags + """ + + _attribute_map = { + "operation": {"key": "operation", "type": "str"}, + "properties": {"key": "properties", "type": "Tags"}, + } + + def __init__( + self, + *, + operation: Optional[Union[str, "_models.TagsPatchOperation"]] = None, + properties: Optional["_models.Tags"] = None, + **kwargs: Any + ) -> None: + """ + :keyword operation: The operation type for the patch API. Known values are: "Replace", "Merge", + and "Delete". + :paramtype operation: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchOperation + :keyword properties: The set of tags. + :paramtype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.Tags + """ + super().__init__(**kwargs) + self.operation = operation + self.properties = properties + + +class TagsResource(_serialization.Model): + """Wrapper resource for tags API requests and responses. + + 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 server. + + :ivar id: The ID of the tags wrapper resource. + :vartype id: str + :ivar name: The name of the tags wrapper resource. + :vartype name: str + :ivar type: The type of the tags wrapper resource. + :vartype type: str + :ivar properties: The set of tags. Required. + :vartype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.Tags + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "properties": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "properties": {"key": "properties", "type": "Tags"}, + } + + def __init__(self, *, properties: "_models.Tags", **kwargs: Any) -> None: + """ + :keyword properties: The set of tags. Required. + :paramtype properties: ~azure.mgmt.resource.resources.v2025_03_01.models.Tags + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.properties = properties + + +class TagValue(_serialization.Model): + """Tag information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The tag value ID. + :vartype id: str + :ivar tag_value: The tag value. + :vartype tag_value: str + :ivar count: The tag value count. + :vartype count: ~azure.mgmt.resource.resources.v2025_03_01.models.TagCount + """ + + _validation = { + "id": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "tag_value": {"key": "tagValue", "type": "str"}, + "count": {"key": "count", "type": "TagCount"}, + } + + def __init__( + self, *, tag_value: Optional[str] = None, count: Optional["_models.TagCount"] = None, **kwargs: Any + ) -> None: + """ + :keyword tag_value: The tag value. + :paramtype tag_value: str + :keyword count: The tag value count. + :paramtype count: ~azure.mgmt.resource.resources.v2025_03_01.models.TagCount + """ + super().__init__(**kwargs) + self.id: Optional[str] = None + self.tag_value = tag_value + self.count = count + + +class TargetResource(_serialization.Model): + """Target resource. + + :ivar id: The Azure resource ID of the resource. + :vartype id: str + :ivar resource_name: The name of the resource. + :vartype resource_name: str + :ivar resource_type: The type of the resource. + :vartype resource_type: str + :ivar extension: The extension the resource was deployed with. + :vartype extension: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionDefinition + :ivar identifiers: The extensible resource identifiers. + :vartype identifiers: JSON + :ivar api_version: The API version the resource was deployed with. + :vartype api_version: str + :ivar symbolic_name: The symbolic name of the resource as defined in the deployment template. + :vartype symbolic_name: str + """ + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "resource_name": {"key": "resourceName", "type": "str"}, + "resource_type": {"key": "resourceType", "type": "str"}, + "extension": {"key": "extension", "type": "DeploymentExtensionDefinition"}, + "identifiers": {"key": "identifiers", "type": "object"}, + "api_version": {"key": "apiVersion", "type": "str"}, + "symbolic_name": {"key": "symbolicName", "type": "str"}, + } + + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + resource_name: Optional[str] = None, + resource_type: Optional[str] = None, + extension: Optional["_models.DeploymentExtensionDefinition"] = None, + identifiers: Optional[JSON] = None, + api_version: Optional[str] = None, + symbolic_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: The Azure resource ID of the resource. + :paramtype id: str + :keyword resource_name: The name of the resource. + :paramtype resource_name: str + :keyword resource_type: The type of the resource. + :paramtype resource_type: str + :keyword extension: The extension the resource was deployed with. + :paramtype extension: + ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtensionDefinition + :keyword identifiers: The extensible resource identifiers. + :paramtype identifiers: JSON + :keyword api_version: The API version the resource was deployed with. + :paramtype api_version: str + :keyword symbolic_name: The symbolic name of the resource as defined in the deployment + template. + :paramtype symbolic_name: str + """ + super().__init__(**kwargs) + self.id = id + self.resource_name = resource_name + self.resource_type = resource_type + self.extension = extension + self.identifiers = identifiers + self.api_version = api_version + self.symbolic_name = symbolic_name + + +class TemplateHashResult(_serialization.Model): + """Result of the request to calculate template hash. It contains a string of minified template and + its hash. + + :ivar minified_template: The minified template string. + :vartype minified_template: str + :ivar template_hash: The template hash. + :vartype template_hash: str + """ + + _attribute_map = { + "minified_template": {"key": "minifiedTemplate", "type": "str"}, + "template_hash": {"key": "templateHash", "type": "str"}, + } + + def __init__( + self, *, minified_template: Optional[str] = None, template_hash: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword minified_template: The minified template string. + :paramtype minified_template: str + :keyword template_hash: The template hash. + :paramtype template_hash: str + """ + super().__init__(**kwargs) + self.minified_template = minified_template + self.template_hash = template_hash + + +class TemplateLink(_serialization.Model): + """Entity representing the reference to the template. + + :ivar uri: The URI of the template to deploy. Use either the uri or id property, but not both. + :vartype uri: str + :ivar id: The resource id of a Template Spec. Use either the id or uri property, but not both. + :vartype id: str + :ivar relative_path: The relativePath property can be used to deploy a linked template at a + location relative to the parent. If the parent template was linked with a TemplateSpec, this + will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child + deployment will be a combination of the parent and relativePath URIs. + :vartype relative_path: str + :ivar content_version: If included, must match the ContentVersion in the template. + :vartype content_version: str + :ivar query_string: The query string (for example, a SAS token) to be used with the + templateLink URI. + :vartype query_string: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + "id": {"key": "id", "type": "str"}, + "relative_path": {"key": "relativePath", "type": "str"}, + "content_version": {"key": "contentVersion", "type": "str"}, + "query_string": {"key": "queryString", "type": "str"}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + relative_path: Optional[str] = None, + content_version: Optional[str] = None, + query_string: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword uri: The URI of the template to deploy. Use either the uri or id property, but not + both. + :paramtype uri: str + :keyword id: The resource id of a Template Spec. Use either the id or uri property, but not + both. + :paramtype id: str + :keyword relative_path: The relativePath property can be used to deploy a linked template at a + location relative to the parent. If the parent template was linked with a TemplateSpec, this + will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child + deployment will be a combination of the parent and relativePath URIs. + :paramtype relative_path: str + :keyword content_version: If included, must match the ContentVersion in the template. + :paramtype content_version: str + :keyword query_string: The query string (for example, a SAS token) to be used with the + templateLink URI. + :paramtype query_string: str + """ + super().__init__(**kwargs) + self.uri = uri + self.id = id + self.relative_path = relative_path + self.content_version = content_version + self.query_string = query_string + + +class WhatIfChange(_serialization.Model): + """Information about a single resource change predicted by What-If operation. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: Resource ID. + :vartype resource_id: str + :ivar deployment_id: The resource id of the Deployment responsible for this change. + :vartype deployment_id: str + :ivar symbolic_name: The symbolic name of the resource responsible for this change. + :vartype symbolic_name: str + :ivar identifiers: A subset of properties that uniquely identify a Bicep extensible resource + because it lacks a resource id like an Azure resource has. + :vartype identifiers: JSON + :ivar change_type: Type of change that will be made to the resource when the deployment is + executed. Required. Known values are: "Create", "Delete", "Ignore", "Deploy", "NoChange", + "Modify", and "Unsupported". + :vartype change_type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ChangeType + :ivar unsupported_reason: The explanation about why the resource is unsupported by What-If. + :vartype unsupported_reason: str + :ivar before: The snapshot of the resource before the deployment is executed. + :vartype before: JSON + :ivar after: The predicted snapshot of the resource after the deployment is executed. + :vartype after: JSON + :ivar delta: The predicted changes to resource properties. + :vartype delta: list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfPropertyChange] + """ + + _validation = { + "change_type": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + "deployment_id": {"key": "deploymentId", "type": "str"}, + "symbolic_name": {"key": "symbolicName", "type": "str"}, + "identifiers": {"key": "identifiers", "type": "object"}, + "change_type": {"key": "changeType", "type": "str"}, + "unsupported_reason": {"key": "unsupportedReason", "type": "str"}, + "before": {"key": "before", "type": "object"}, + "after": {"key": "after", "type": "object"}, + "delta": {"key": "delta", "type": "[WhatIfPropertyChange]"}, + } + + def __init__( + self, + *, + change_type: Union[str, "_models.ChangeType"], + resource_id: Optional[str] = None, + deployment_id: Optional[str] = None, + symbolic_name: Optional[str] = None, + identifiers: Optional[JSON] = None, + unsupported_reason: Optional[str] = None, + before: Optional[JSON] = None, + after: Optional[JSON] = None, + delta: Optional[List["_models.WhatIfPropertyChange"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_id: Resource ID. + :paramtype resource_id: str + :keyword deployment_id: The resource id of the Deployment responsible for this change. + :paramtype deployment_id: str + :keyword symbolic_name: The symbolic name of the resource responsible for this change. + :paramtype symbolic_name: str + :keyword identifiers: A subset of properties that uniquely identify a Bicep extensible resource + because it lacks a resource id like an Azure resource has. + :paramtype identifiers: JSON + :keyword change_type: Type of change that will be made to the resource when the deployment is + executed. Required. Known values are: "Create", "Delete", "Ignore", "Deploy", "NoChange", + "Modify", and "Unsupported". + :paramtype change_type: str or ~azure.mgmt.resource.resources.v2025_03_01.models.ChangeType + :keyword unsupported_reason: The explanation about why the resource is unsupported by What-If. + :paramtype unsupported_reason: str + :keyword before: The snapshot of the resource before the deployment is executed. + :paramtype before: JSON + :keyword after: The predicted snapshot of the resource after the deployment is executed. + :paramtype after: JSON + :keyword delta: The predicted changes to resource properties. + :paramtype delta: list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfPropertyChange] + """ + super().__init__(**kwargs) + self.resource_id = resource_id + self.deployment_id = deployment_id + self.symbolic_name = symbolic_name + self.identifiers = identifiers + self.change_type = change_type + self.unsupported_reason = unsupported_reason + self.before = before + self.after = after + self.delta = delta + + +class WhatIfOperationResult(_serialization.Model): + """Result of the What-If operation. Contains a list of predicted changes and a URL link to get to + the next set of results. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar status: Status of the What-If operation. + :vartype status: str + :ivar error: Error when What-If operation fails. + :vartype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + :ivar changes: List of resource changes predicted by What-If operation. + :vartype changes: list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfChange] + :ivar potential_changes: List of resource changes predicted by What-If operation. + :vartype potential_changes: + list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfChange] + :ivar diagnostics: List of resource diagnostics detected by What-If operation. + :vartype diagnostics: + list[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentDiagnosticsDefinition] + """ + + _validation = { + "diagnostics": {"readonly": True}, + } + + _attribute_map = { + "status": {"key": "status", "type": "str"}, + "error": {"key": "error", "type": "ErrorResponse"}, + "changes": {"key": "properties.changes", "type": "[WhatIfChange]"}, + "potential_changes": {"key": "properties.potentialChanges", "type": "[WhatIfChange]"}, + "diagnostics": {"key": "properties.diagnostics", "type": "[DeploymentDiagnosticsDefinition]"}, + } + + def __init__( + self, + *, + status: Optional[str] = None, + error: Optional["_models.ErrorResponse"] = None, + changes: Optional[List["_models.WhatIfChange"]] = None, + potential_changes: Optional[List["_models.WhatIfChange"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword status: Status of the What-If operation. + :paramtype status: str + :keyword error: Error when What-If operation fails. + :paramtype error: ~azure.mgmt.resource.resources.v2025_03_01.models.ErrorResponse + :keyword changes: List of resource changes predicted by What-If operation. + :paramtype changes: list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfChange] + :keyword potential_changes: List of resource changes predicted by What-If operation. + :paramtype potential_changes: + list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfChange] + """ + super().__init__(**kwargs) + self.status = status + self.error = error + self.changes = changes + self.potential_changes = potential_changes + self.diagnostics: Optional[List["_models.DeploymentDiagnosticsDefinition"]] = None + + +class WhatIfPropertyChange(_serialization.Model): + """The predicted change to the resource property. + + All required parameters must be populated in order to send to server. + + :ivar path: The path of the property. Required. + :vartype path: str + :ivar property_change_type: The type of property change. Required. Known values are: "Create", + "Delete", "Modify", "Array", and "NoEffect". + :vartype property_change_type: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.PropertyChangeType + :ivar before: The value of the property before the deployment is executed. + :vartype before: JSON + :ivar after: The value of the property after the deployment is executed. + :vartype after: JSON + :ivar children: Nested property changes. + :vartype children: list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfPropertyChange] + """ + + _validation = { + "path": {"required": True}, + "property_change_type": {"required": True}, + } + + _attribute_map = { + "path": {"key": "path", "type": "str"}, + "property_change_type": {"key": "propertyChangeType", "type": "str"}, + "before": {"key": "before", "type": "object"}, + "after": {"key": "after", "type": "object"}, + "children": {"key": "children", "type": "[WhatIfPropertyChange]"}, + } + + def __init__( + self, + *, + path: str, + property_change_type: Union[str, "_models.PropertyChangeType"], + before: Optional[JSON] = None, + after: Optional[JSON] = None, + children: Optional[List["_models.WhatIfPropertyChange"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword path: The path of the property. Required. + :paramtype path: str + :keyword property_change_type: The type of property change. Required. Known values are: + "Create", "Delete", "Modify", "Array", and "NoEffect". + :paramtype property_change_type: str or + ~azure.mgmt.resource.resources.v2025_03_01.models.PropertyChangeType + :keyword before: The value of the property before the deployment is executed. + :paramtype before: JSON + :keyword after: The value of the property after the deployment is executed. + :paramtype after: JSON + :keyword children: Nested property changes. + :paramtype children: + list[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfPropertyChange] + """ + super().__init__(**kwargs) + self.path = path + self.property_change_type = property_change_type + self.before = before + self.after = after + self.children = children + + +class ZoneMapping(_serialization.Model): + """ZoneMapping. + + :ivar location: The location of the zone mapping. + :vartype location: str + :ivar zones: + :vartype zones: list[str] + """ + + _attribute_map = { + "location": {"key": "location", "type": "str"}, + "zones": {"key": "zones", "type": "[str]"}, + } + + def __init__(self, *, location: Optional[str] = None, zones: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword location: The location of the zone mapping. + :paramtype location: str + :keyword zones: + :paramtype zones: list[str] + """ + super().__init__(**kwargs) + self.location = location + self.zones = zones diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_patch.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_resource_management_client_enums.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_resource_management_client_enums.py new file mode 100644 index 000000000000..6f8b09be13b7 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/models/_resource_management_client_enums.py @@ -0,0 +1,271 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 azure.core import CaseInsensitiveEnumMeta + + +class AliasPathAttributes(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The attributes of the token that the alias path is referring to.""" + + NONE = "None" + """The token that the alias path is referring to has no attributes.""" + MODIFIABLE = "Modifiable" + """The token that the alias path is referring to is modifiable by policies with 'modify' effect.""" + + +class AliasPathTokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the token that the alias path is referring to.""" + + NOT_SPECIFIED = "NotSpecified" + """The token type is not specified.""" + ANY = "Any" + """The token type can be anything.""" + STRING = "String" + """The token type is string.""" + OBJECT = "Object" + """The token type is object.""" + ARRAY = "Array" + """The token type is array.""" + INTEGER = "Integer" + """The token type is integer.""" + NUMBER = "Number" + """The token type is number.""" + BOOLEAN = "Boolean" + """The token type is boolean.""" + + +class AliasPatternType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of alias pattern.""" + + NOT_SPECIFIED = "NotSpecified" + """NotSpecified is not allowed.""" + EXTRACT = "Extract" + """Extract is the only allowed value.""" + + +class AliasType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the alias.""" + + NOT_SPECIFIED = "NotSpecified" + """Alias type is unknown (same as not providing alias type).""" + PLAIN_TEXT = "PlainText" + """Alias value is not secret.""" + MASK = "Mask" + """Alias value is secret.""" + + +class ChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of change that will be made to the resource when the deployment is executed.""" + + CREATE = "Create" + """The resource does not exist in the current state but is present in the desired state. The + resource will be created when the deployment is executed.""" + DELETE = "Delete" + """The resource exists in the current state and is missing from the desired state. The resource + will be deleted when the deployment is executed.""" + IGNORE = "Ignore" + """The resource exists in the current state and is missing from the desired state. The resource + will not be deployed or modified when the deployment is executed.""" + DEPLOY = "Deploy" + """The resource exists in the current state and the desired state and will be redeployed when the + deployment is executed. The properties of the resource may or may not change.""" + NO_CHANGE = "NoChange" + """The resource exists in the current state and the desired state and will be redeployed when the + deployment is executed. The properties of the resource will not change.""" + MODIFY = "Modify" + """The resource exists in the current state and the desired state and will be redeployed when the + deployment is executed. The properties of the resource will change.""" + UNSUPPORTED = "Unsupported" + """The resource is not supported by What-If.""" + + +class DeploymentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode that is used to deploy resources. This value can be either Incremental or Complete. In + Incremental mode, resources are deployed without deleting existing resources that are not + included in the template. In Complete mode, resources are deployed and existing resources in + the resource group that are not included in the template are deleted. Be careful when using + Complete mode as you may unintentionally delete resources. + """ + + INCREMENTAL = "Incremental" + COMPLETE = "Complete" + + +class ExportTemplateOutputFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The output format for the exported resources.""" + + JSON = "Json" + BICEP = "Bicep" + + +class ExpressionEvaluationOptionsScopeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The scope to be used for evaluation of parameters, variables and functions in a nested + template. + """ + + NOT_SPECIFIED = "NotSpecified" + OUTER = "Outer" + INNER = "Inner" + + +class ExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The extended location type.""" + + EDGE_ZONE = "EdgeZone" + + +class ExtensionConfigPropertyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ExtensionConfigPropertyType.""" + + STRING = "String" + """Property type representing a string value.""" + INT = "Int" + """Property type representing an integer value.""" + BOOL = "Bool" + """Property type representing a boolean value.""" + ARRAY = "Array" + """Property type representing an array value.""" + OBJECT = "Object" + """Property type representing an object value.""" + SECURE_STRING = "SecureString" + """Property type representing a secure string value.""" + SECURE_OBJECT = "SecureObject" + """Property type representing a secure object value.""" + INT_ENUM = "Int" + """Property type representing an integer value.""" + + +class Level(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Denotes the additional response level.""" + + WARNING = "Warning" + INFO = "Info" + ERROR = "Error" + + +class OnErrorDeploymentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The deployment on error behavior type. Possible values are LastSuccessful and + SpecificDeployment. + """ + + LAST_SUCCESSFUL = "LastSuccessful" + SPECIFIC_DEPLOYMENT = "SpecificDeployment" + + +class PropertyChangeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of property change.""" + + CREATE = "Create" + """The property does not exist in the current state but is present in the desired state. The + property will be created when the deployment is executed.""" + DELETE = "Delete" + """The property exists in the current state and is missing from the desired state. It will be + deleted when the deployment is executed.""" + MODIFY = "Modify" + """The property exists in both current and desired state and is different. The value of the + property will change when the deployment is executed.""" + ARRAY = "Array" + """The property is an array and contains nested changes.""" + NO_EFFECT = "NoEffect" + """The property will not be set or updated.""" + + +class ProviderAuthorizationConsentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provider authorization consent state.""" + + NOT_SPECIFIED = "NotSpecified" + REQUIRED = "Required" + NOT_REQUIRED = "NotRequired" + CONSENTED = "Consented" + + +class ProvisioningOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The name of the current provisioning operation.""" + + NOT_SPECIFIED = "NotSpecified" + """The provisioning operation is not specified.""" + CREATE = "Create" + """The provisioning operation is create.""" + DELETE = "Delete" + """The provisioning operation is delete.""" + WAITING = "Waiting" + """The provisioning operation is waiting.""" + AZURE_ASYNC_OPERATION_WAITING = "AzureAsyncOperationWaiting" + """The provisioning operation is waiting Azure async operation.""" + RESOURCE_CACHE_WAITING = "ResourceCacheWaiting" + """The provisioning operation is waiting for resource cache.""" + ACTION = "Action" + """The provisioning operation is action.""" + READ = "Read" + """The provisioning operation is read.""" + EVALUATE_DEPLOYMENT_OUTPUT = "EvaluateDeploymentOutput" + """The provisioning operation is evaluate output.""" + DEPLOYMENT_CLEANUP = "DeploymentCleanup" + """The provisioning operation is cleanup. This operation is part of the 'complete' mode + deployment.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Denotes the state of provisioning.""" + + NOT_SPECIFIED = "NotSpecified" + ACCEPTED = "Accepted" + RUNNING = "Running" + READY = "Ready" + CREATING = "Creating" + CREATED = "Created" + DELETING = "Deleting" + DELETED = "Deleted" + CANCELED = "Canceled" + FAILED = "Failed" + SUCCEEDED = "Succeeded" + UPDATING = "Updating" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The identity type.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" + NONE = "None" + + +class TagsPatchOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The operation type for the patch API.""" + + REPLACE = "Replace" + """The 'replace' option replaces the entire set of existing tags with a new set.""" + MERGE = "Merge" + """The 'merge' option allows adding tags with new names and updating the values of tags with + existing names.""" + DELETE = "Delete" + """The 'delete' option allows selectively deleting tags based on given names or name/value pairs.""" + + +class ValidationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The level of validation performed on the deployment.""" + + TEMPLATE = "Template" + """Static analysis of the template is performed.""" + PROVIDER = "Provider" + """Static analysis of the template is performed and resource declarations are sent to resource + providers for semantic validation. Validates that the caller has RBAC write permissions on each + resource.""" + PROVIDER_NO_RBAC = "ProviderNoRbac" + """Static analysis of the template is performed and resource declarations are sent to resource + providers for semantic validation. Skips validating that the caller has RBAC write permissions + on each resource.""" + + +class WhatIfResultFormat(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The format of the What-If results.""" + + RESOURCE_ID_ONLY = "ResourceIdOnly" + FULL_RESOURCE_PAYLOADS = "FullResourcePayloads" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/__init__.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/__init__.py new file mode 100644 index 000000000000..fc92299ca9cb --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position + +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import DeploymentsOperations # type: ignore +from ._operations import ProvidersOperations # type: ignore +from ._operations import ProviderResourceTypesOperations # type: ignore +from ._operations import ResourcesOperations # type: ignore +from ._operations import ResourceGroupsOperations # type: ignore +from ._operations import TagsOperations # type: ignore +from ._operations import DeploymentOperationsOperations # type: ignore + +from ._patch import __all__ as _patch_all +from ._patch import * +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "Operations", + "DeploymentsOperations", + "ProvidersOperations", + "ProviderResourceTypesOperations", + "ResourcesOperations", + "ResourceGroupsOperations", + "TagsOperations", + "DeploymentOperationsOperations", +] +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore +_patch_sdk() diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_operations.py new file mode 100644 index 000000000000..92ef17050cb4 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_operations.py @@ -0,0 +1,12763 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from ..._serialization import Deserializer, Serializer +from .._configuration import ResourceManagementClientConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_operations_list_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/operations") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_check_existence_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_get_at_scope_request(scope: str, deployment_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_cancel_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_validate_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_export_template_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" + ) + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_at_scope_request( + scope: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_check_existence_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_get_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_cancel_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/cancel") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_validate_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/validate") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_what_if_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_export_template_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_at_tenant_scope_request( # pylint: disable=name-too-long + *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/") + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_check_existence_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_get_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_cancel_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_validate_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_what_if_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_export_template_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_check_existence_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_get_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}" + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_cancel_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_validate_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_what_if_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_export_template_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_at_subscription_scope_request( # pylint: disable=name-too-long + subscription_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_delete_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_check_existence_request( # pylint: disable=name-too-long + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_get_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_cancel_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_validate_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/validate", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_what_if_request( + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_export_template_request( # pylint: disable=name-too-long + resource_group_name: str, deployment_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/", + ) + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployments_calculate_template_hash_request( # pylint: disable=name-too-long + *, json: JSON, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/calculateTemplateHash") + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, json=json, **kwargs) + + +def build_providers_unregister_request( + resource_provider_namespace: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/unregister" + ) + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_register_at_management_group_scope_request( # pylint: disable=name-too-long + resource_provider_namespace: str, group_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/{resourceProviderNamespace}/register", + ) + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_provider_permissions_request( # pylint: disable=name-too-long + resource_provider_namespace: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/providerPermissions" + ) + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_register_request( + resource_provider_namespace: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register") + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_list_request(subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_list_at_tenant_scope_request( # pylint: disable=name-too-long + *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers") + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_get_request( + resource_provider_namespace: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}") + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_providers_get_at_tenant_scope_request( # pylint: disable=name-too-long + resource_provider_namespace: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/{resourceProviderNamespace}") + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_provider_resource_types_list_request( # pylint: disable=name-too-long + resource_provider_namespace: str, subscription_id: str, *, expand: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/resourceTypes" + ) + path_format_arguments = { + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/resources") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_move_resources_request( + source_resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/moveResources" + ) + path_format_arguments = { + "sourceResourceGroupName": _SERIALIZER.url( + "source_resource_group_name", + source_resource_group_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[-\w\._\(\)]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_validate_move_resources_request( # pylint: disable=name-too-long + source_resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/resourceGroups/{sourceResourceGroupName}/validateMoveResources" + ) + path_format_arguments = { + "sourceResourceGroupName": _SERIALIZER.url( + "source_resource_group_name", + source_resource_group_name, + "str", + max_length=90, + min_length=1, + pattern=r"^[-\w\._\(\)]+$", + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_list_request( + subscription_id: str, + *, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_check_existence_request( + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), + "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_delete_request( + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), + "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_create_or_update_request( + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), + "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_update_request( + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), + "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_get_request( + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + subscription_id: str, + *, + api_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{parentResourcePath}/{resourceType}/{resourceName}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "resourceProviderNamespace": _SERIALIZER.url("resource_provider_namespace", resource_provider_namespace, "str"), + "parentResourcePath": _SERIALIZER.url("parent_resource_path", parent_resource_path, "str", skip_quote=True), + "resourceType": _SERIALIZER.url("resource_type", resource_type, "str", skip_quote=True), + "resourceName": _SERIALIZER.url("resource_name", resource_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_check_existence_by_id_request( # pylint: disable=name-too-long + resource_id: str, *, api_version: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_delete_by_id_request(resource_id: str, *, api_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_create_or_update_by_id_request( # pylint: disable=name-too-long + resource_id: str, *, api_version: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_update_by_id_request(resource_id: str, *, api_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resources_get_by_id_request(resource_id: str, *, api_version: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{resourceId}") + path_format_arguments = { + "resourceId": _SERIALIZER.url("resource_id", resource_id, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_check_existence_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="HEAD", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_delete_request( + resource_group_name: str, subscription_id: str, *, force_deletion_types: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if force_deletion_types is not None: + _params["forceDeletionTypes"] = _SERIALIZER.query("force_deletion_types", force_deletion_types, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_get_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_update_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}") + 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: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_export_template_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/exportTemplate" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_resource_groups_list_request( + subscription_id: str, *, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_delete_value_request(tag_name: str, tag_value: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + path_format_arguments = { + "tagName": _SERIALIZER.url("tag_name", tag_name, "str"), + "tagValue": _SERIALIZER.url("tag_value", tag_value, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_create_or_update_value_request( # pylint: disable=name-too-long + tag_name: str, tag_value: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/tagNames/{tagName}/tagValues/{tagValue}") + path_format_arguments = { + "tagName": _SERIALIZER.url("tag_name", tag_name, "str"), + "tagValue": _SERIALIZER.url("tag_value", tag_value, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_create_or_update_request(tag_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/tagNames/{tagName}") + path_format_arguments = { + "tagName": _SERIALIZER.url("tag_name", tag_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_delete_request(tag_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/tagNames/{tagName}") + path_format_arguments = { + "tagName": _SERIALIZER.url("tag_name", tag_name, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/tagNames") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_create_or_update_at_scope_request( # pylint: disable=name-too-long + scope: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/tags/default") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_update_at_scope_request(scope: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/tags/default") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_get_at_scope_request(scope: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/tags/default") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tags_delete_at_scope_request(scope: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/tags/default") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_get_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, operation_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + ) + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_list_at_scope_request( # pylint: disable=name-too-long + scope: str, deployment_name: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + path_format_arguments = { + "scope": _SERIALIZER.url("scope", scope, "str", skip_quote=True), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_get_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, operation_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_list_at_tenant_scope_request( # pylint: disable=name-too-long + deployment_name: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Resources/deployments/{deploymentName}/operations") + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_get_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, operation_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_list_at_management_group_scope_request( # pylint: disable=name-too-long + group_id: str, deployment_name: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", + ) + path_format_arguments = { + "groupId": _SERIALIZER.url("group_id", group_id, "str", max_length=90, min_length=1), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_get_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_list_at_subscription_scope_request( # pylint: disable=name-too-long + deployment_name: str, subscription_id: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/operations", + ) + path_format_arguments = { + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_get_request( + resource_group_name: str, deployment_name: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations/{operationId}", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_deployment_operations_list_request( + resource_group_name: str, deployment_name: str, subscription_id: str, *, top: Optional[int] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/deployments/{deploymentName}/operations", + ) + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "deploymentName": _SERIALIZER.url( + "deployment_name", deployment_name, "str", max_length=64, min_length=1, pattern=r"^[-\w\._\(\)]+$" + ), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """Lists all of the available Microsoft.Resources REST API operations. + + :return: An iterator like instance of either Operation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _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) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + +class DeploymentsOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`deployments` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + def _delete_at_scope_initial(self, scope: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def check_existence_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _create_or_update_at_scope_initial( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_at_scope( + self, + scope: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_at_scope( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at a given scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_at_scope(self, scope: str, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel_at_scope( # pylint: disable=inconsistent-return-statements + self, scope: str, deployment_name: str, **kwargs: Any + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _validate_at_scope_initial( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_at_scope( + self, + scope: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_at_scope( + self, scope: str, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_at_scope_initial( + scope=scope, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def export_template_at_scope( + self, scope: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_scope_request( + scope=scope, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_scope( + self, scope: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentExtended"]: + """Get all the deployments at the given scope. + + :param scope: The resource scope. Required. + :type scope: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_scope_request( + scope=scope, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _delete_at_tenant_scope_initial(self, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_at_tenant_scope_initial( + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def check_existence_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _create_or_update_at_tenant_scope_initial( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_create_or_update_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at tenant scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel_at_tenant_scope( # pylint: disable=inconsistent-return-statements + self, deployment_name: str, **kwargs: Any + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _validate_at_tenant_scope_initial( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_validate_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _what_if_at_tenant_scope_initial( + self, deployment_name: str, parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeploymentWhatIf") + + _request = build_deployments_what_if_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_what_if_at_tenant_scope( + self, + deployment_name: str, + parameters: _models.ScopedDeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_what_if_at_tenant_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_what_if_at_tenant_scope( + self, deployment_name: str, parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the tenant + group. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf or + IO[bytes] + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._what_if_at_tenant_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def export_template_at_tenant_scope(self, deployment_name: str, **kwargs: Any) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_tenant_scope_request( + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_tenant_scope( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentExtended"]: + """Get all the deployments at the tenant scope. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_tenant_scope_request( + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _delete_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_at_management_group_scope( + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def check_existence_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> bool: + """Checks whether the deployment exists. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _create_or_update_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_create_or_update_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at management group scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a + ScopedDeployment type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_at_management_group_scope( + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExtended: + """Gets a deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel_at_management_group_scope( # pylint: disable=inconsistent-return-statements + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _validate_at_management_group_scope_initial( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeployment") + + _request = build_deployments_validate_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_at_management_group_scope( + self, group_id: str, deployment_name: str, parameters: Union[_models.ScopedDeployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeployment type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeployment or + IO[bytes] + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _what_if_at_management_group_scope_initial( # pylint: disable=name-too-long + self, + group_id: str, + deployment_name: str, + parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ScopedDeploymentWhatIf") + + _request = build_deployments_what_if_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: _models.ScopedDeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_what_if_at_management_group_scope( + self, + group_id: str, + deployment_name: str, + parameters: Union[_models.ScopedDeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the management + group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a ScopedDeploymentWhatIf type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ScopedDeploymentWhatIf or + IO[bytes] + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._what_if_at_management_group_scope_initial( + group_id=group_id, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def export_template_at_management_group_scope( # pylint: disable=name-too-long + self, group_id: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_management_group_scope( + self, group_id: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentExtended"]: + """Get all the deployments for a management group. + + :param group_id: The management group ID. Required. + :type group_id: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_management_group_scope_request( + group_id=group_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _delete_at_subscription_scope_initial(self, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. This is an asynchronous operation that + returns a status of 202 until the template deployment is successfully deleted. The Location + response header contains the URI that is used to obtain the status of the process. While the + process is running, a call to the URI in the Location header returns a status of 202. When the + process finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_at_subscription_scope_initial( + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def check_existence_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _create_or_update_at_subscription_scope_initial( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_at_subscription_scope( # pylint: disable=name-too-long + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources at subscription scope. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_at_subscription_scope(self, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel_at_subscription_scope( # pylint: disable=inconsistent-return-statements + self, deployment_name: str, **kwargs: Any + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resources partially + deployed. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _validate_at_subscription_scope_initial( + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_at_subscription_scope( + self, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_at_subscription_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_at_subscription_scope( + self, deployment_name: str, parameters: Union[_models.Deployment, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _what_if_at_subscription_scope_initial( + self, deployment_name: str, parameters: Union[_models.DeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DeploymentWhatIf") + + _request = build_deployments_what_if_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_what_if_at_subscription_scope( + self, + deployment_name: str, + parameters: _models.DeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_what_if_at_subscription_scope( + self, deployment_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_what_if_at_subscription_scope( + self, deployment_name: str, parameters: Union[_models.DeploymentWhatIf, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the + subscription. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to What If. Is either a DeploymentWhatIf type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf or + IO[bytes] + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._what_if_at_subscription_scope_initial( + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def export_template_at_subscription_scope( + self, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_subscription_scope( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentExtended"]: + """Get all the deployments for a subscription. + + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_at_subscription_scope_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _delete_initial(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_deployments_delete_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a deployment from the deployment history. + + A template deployment that is currently running cannot be deleted. Deleting a template + deployment removes the associated deployment operations. Deleting a template deployment does + not affect the state of the resource group. This is an asynchronous operation that returns a + status of 202 until the template deployment is successfully deleted. The Location response + header contains the URI that is used to obtain the status of the process. While the process is + running, a call to the URI in the Location header returns a status of 202. When the process + finishes, the URI in the Location header returns a status of 204 on success. If the + asynchronous request failed, the URI in the Location header returns an error-level status code. + + :param resource_group_name: The name of the resource group with the deployment to delete. The + name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def check_existence(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> bool: + """Checks whether the deployment exists. + + :param resource_group_name: The name of the resource group with the deployment to check. The + name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_check_existence_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _create_or_update_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_create_or_update_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeploymentExtended]: + """Deploys resources to a resource group. + + You can provide the template and parameters directly in the request or link to JSON files. + + :param resource_group_name: The name of the resource group to deploy the resources to. The name + is case insensitive. The resource group must already exist. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Additional parameters supplied to the operation. Is either a Deployment type + or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentExtended or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentExtended", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentExtended].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentExtended]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get(self, resource_group_name: str, deployment_name: str, **kwargs: Any) -> _models.DeploymentExtended: + """Gets a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExtended or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExtended] = kwargs.pop("cls", None) + + _request = build_deployments_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExtended", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def cancel( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> None: + """Cancels a currently running template deployment. + + You can cancel a deployment only if the provisioningState is Accepted or Running. After the + deployment is canceled, the provisioningState is set to Canceled. Canceling a template + deployment stops the currently running template deployment and leaves the resource group + partially deployed. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_deployments_cancel_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + def _validate_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "Deployment") + + _request = build_deployments_validate_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 400]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.Deployment, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.Deployment, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.DeploymentValidateResult]: + """Validates whether the specified template is syntactically correct and will be accepted by Azure + Resource Manager.. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a Deployment type or a IO[bytes] type. + Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.Deployment or IO[bytes] + :return: An instance of LROPoller that returns either DeploymentValidateResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentValidateResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.DeploymentValidateResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("DeploymentValidateResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.DeploymentValidateResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.DeploymentValidateResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _what_if_initial( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.DeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "DeploymentWhatIf") + + _request = build_deployments_what_if_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("str", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: _models.DeploymentWhatIf, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_what_if( + self, + resource_group_name: str, + deployment_name: str, + parameters: Union[_models.DeploymentWhatIf, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.WhatIfOperationResult]: + """Returns changes that will be made by the deployment if executed at the scope of the resource + group. + + :param resource_group_name: The name of the resource group the template will be deployed to. + The name is case insensitive. Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param parameters: Parameters to validate. Is either a DeploymentWhatIf type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentWhatIf or + IO[bytes] + :return: An instance of LROPoller that returns either WhatIfOperationResult or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.WhatIfOperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.WhatIfOperationResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._what_if_initial( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("WhatIfOperationResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.WhatIfOperationResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.WhatIfOperationResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def export_template( + self, resource_group_name: str, deployment_name: str, **kwargs: Any + ) -> _models.DeploymentExportResult: + """Exports the template used for specified deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :return: DeploymentExportResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExportResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentExportResult] = kwargs.pop("cls", None) + + _request = build_deployments_export_template_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentExportResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_resource_group( + self, resource_group_name: str, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentExtended"]: + """Get all the deployments for a resource group. + + :param resource_group_name: The name of the resource group with the deployments to get. The + name is case insensitive. Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation. For example, you can use + $filter=provisioningState eq '{state}'. Default value is None. + :type filter: str + :param top: The number of results to get. If null is passed, returns all deployments. Default + value is None. + :type top: int + :return: An iterator like instance of either DeploymentExtended or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentExtended] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployments_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def calculate_template_hash(self, template: JSON, **kwargs: Any) -> _models.TemplateHashResult: + """Calculate the hash of the given template. + + :param template: The template provided to calculate hash. Required. + :type template: JSON + :return: TemplateHashResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TemplateHashResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) + cls: ClsType[_models.TemplateHashResult] = kwargs.pop("cls", None) + + _json = self._serialize.body(template, "object") + + _request = build_deployments_calculate_template_hash_request( + api_version=api_version, + content_type=content_type, + json=_json, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("TemplateHashResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProvidersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`providers` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def unregister(self, resource_provider_namespace: str, **kwargs: Any) -> _models.Provider: + """Unregisters a subscription from a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to unregister. + Required. + :type resource_provider_namespace: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_unregister_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def register_at_management_group_scope( # pylint: disable=inconsistent-return-statements + self, resource_provider_namespace: str, group_id: str, **kwargs: Any + ) -> None: + """Registers a management group with a resource provider. Use this operation to register a + resource provider with resource types that can be deployed at the management group scope. It + does not recursively register subscriptions within the management group. Instead, you must + register subscriptions individually. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param group_id: The management group ID. Required. + :type group_id: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_providers_register_at_management_group_scope_request( + resource_provider_namespace=resource_provider_namespace, + group_id=group_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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, {}) # type: ignore + + @distributed_trace + def provider_permissions( + self, resource_provider_namespace: str, **kwargs: Any + ) -> _models.ProviderPermissionListResult: + """Get the provider permissions. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :return: ProviderPermissionListResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderPermissionListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderPermissionListResult] = kwargs.pop("cls", None) + + _request = build_providers_provider_permissions_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ProviderPermissionListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def register( + self, + resource_provider_namespace: str, + properties: Optional[_models.ProviderRegistrationRequest] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Default value is None. + :type properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderRegistrationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def register( + self, + resource_provider_namespace: str, + properties: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Default value is None. + :type properties: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def register( + self, + resource_provider_namespace: str, + properties: Optional[Union[_models.ProviderRegistrationRequest, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.Provider: + """Registers a subscription with a resource provider. + + :param resource_provider_namespace: The namespace of the resource provider to register. + Required. + :type resource_provider_namespace: str + :param properties: The third party consent for S2S. Is either a ProviderRegistrationRequest + type or a IO[bytes] type. Default value is None. + :type properties: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderRegistrationRequest + or IO[bytes] + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + if properties is not None: + _json = self._serialize.body(properties, "ProviderRegistrationRequest") + else: + _json = None + + _request = build_providers_register_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Provider"]: + """Gets all resource providers for a subscription. + + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: An iterator like instance of either Provider or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_providers_list_request( + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def list_at_tenant_scope(self, expand: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Provider"]: + """Gets all resource providers for the tenant. + + :param expand: The properties to include in the results. For example, use &$expand=metadata in + the query string to retrieve resource provider metadata. To include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: An iterator like instance of either Provider or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.Provider] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_providers_list_at_tenant_scope_request( + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ProviderListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def get(self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any) -> _models.Provider: + """Gets the specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_get_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_at_tenant_scope( + self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.Provider: + """Gets the specified resource provider at the tenant level. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: Provider or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.Provider + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.Provider] = kwargs.pop("cls", None) + + _request = build_providers_get_at_tenant_scope_request( + resource_provider_namespace=resource_provider_namespace, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("Provider", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProviderResourceTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`provider_resource_types` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list( + self, resource_provider_namespace: str, expand: Optional[str] = None, **kwargs: Any + ) -> _models.ProviderResourceTypeListResult: + """List the resource types for a specified resource provider. + + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param expand: The $expand query parameter. For example, to include property aliases in + response, use $expand=resourceTypes/aliases. Default value is None. + :type expand: str + :return: ProviderResourceTypeListResult or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ProviderResourceTypeListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ProviderResourceTypeListResult] = kwargs.pop("cls", None) + + _request = build_provider_resource_types_list_request( + resource_provider_namespace=resource_provider_namespace, + subscription_id=self._config.subscription_id, + expand=expand, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ProviderResourceTypeListResult", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ResourcesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`resources` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + expand: Optional[str] = None, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable["_models.GenericResourceExpanded"]: + """Get all the resources for a resource group. + + :param resource_group_name: The resource group with the resources to get. Required. + :type resource_group_name: str + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`The + properties you can use for eq (equals) or ne (not equals) are: location, resourceType, name, + resourceGroup, identity, identity/principalId, plan, plan/publisher, plan/product, plan/name, + plan/version, and plan/promotionCode.\\ :code:`
`\\ :code:`
`For example, to filter by a + resource type, use: $filter=resourceType eq 'Microsoft.Network/virtualNetworks'\\ + :code:`
`\\ :code:`
`You can use substringof(value, property) in the filter. The + properties you can use for substring are: name and resourceGroup.\\ :code:`
`\\ + :code:`
`For example, to get all resources with 'demo' anywhere in the name, use: + $filter=substringof('demo', name)\\ :code:`
`\\ :code:`
`You can link more than one + substringof together by adding and/or operators.\\ :code:`
`\\ :code:`
`You can filter by + tag names and values. For example, to filter for a tag name and value, use $filter=tagName eq + 'tag1' and tagValue eq 'Value1'. When you filter by a tag name and value, the tags for each + resource are not returned in the results.\\ :code:`
`\\ :code:`
`You can use some + properties together when filtering. The combinations you can use are: substringof and/or + resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. Default + value is None. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\\ , ``changedTime`` and ``provisioningState``. For + example, ``$expand=createdTime,changedTime``. Default value is None. + :type expand: str + :param top: The number of results to return. If null is passed, returns all resources. Default + value is None. + :type top: int + :return: An iterator like instance of either GenericResourceExpanded or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resources_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _move_resources_initial( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourcesMoveInfo") + + _request = build_resources_move_resources_request( + source_resource_group_name=source_resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_move_resources( + self, + source_resource_group_name: str, + parameters: _models.ResourcesMoveInfo, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_move_resources( + self, + source_resource_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_move_resources( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Moves resources from one resource group to another resource group. + + The resources to be moved must be in the same source resource group in the source subscription + being used. The target resource group may be in a different subscription. When moving + resources, both the source group and the target group are locked for the duration of the + operation. Write and delete operations are blocked on the groups until the move completes. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be moved. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _validate_move_resources_initial( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourcesMoveInfo") + + _request = build_resources_validate_move_resources_request( + source_resource_group_name=source_resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: _models.ResourcesMoveInfo, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_move_resources( + self, + source_resource_group_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_move_resources( + self, source_resource_group_name: str, parameters: Union[_models.ResourcesMoveInfo, IO[bytes]], **kwargs: Any + ) -> LROPoller[None]: + """Validates whether resources can be moved from one resource group to another resource group. + + This operation checks whether the specified resources can be moved to the target. The resources + to be moved must be in the same source resource group in the source subscription being used. + The target resource group may be in a different subscription. If validation succeeds, it + returns HTTP response code 204 (no content). If validation fails, it returns HTTP response code + 409 (Conflict) with an error message. Retrieve the URL in the Location header value to check + the result of the long-running operation. + + :param source_resource_group_name: The name of the resource group from the source subscription + containing the resources to be validated for move. Required. + :type source_resource_group_name: str + :param parameters: Parameters for moving resources. Is either a ResourcesMoveInfo type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourcesMoveInfo or + IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._validate_move_resources_initial( + source_resource_group_name=source_resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, filter: Optional[str] = None, expand: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.GenericResourceExpanded"]: + """Get all the resources in a subscription. + + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`Filter + comparison operators include ``eq`` (equals) and ``ne`` (not equals) and may be used with the + following properties: ``location``\\ , ``resourceType``\\ , ``name``\\ , ``resourceGroup``\\ , + ``identity``\\ , ``identity/principalId``\\ , ``plan``\\ , ``plan/publisher``\\ , + ``plan/product``\\ , ``plan/name``\\ , ``plan/version``\\ , and ``plan/promotionCode``.\\ + :code:`
`\\ :code:`
`For example, to filter by a resource type, use + ``$filter=resourceType eq 'Microsoft.Network/virtualNetworks'``\\ :code:`
`\\ :code:`
`\\ + :code:`
`\\ ``substringof(value, property)`` can be used to filter for substrings of the + following currently-supported properties: ``name`` and ``resourceGroup``\\ :code:`
`\\ + :code:`
`For example, to get all resources with 'demo' anywhere in the resource name, use + ``$filter=substringof('demo', name)``\\ :code:`
`\\ :code:`
`Multiple substring + operations can also be combined using ``and``\\ /\\ ``or`` operators.\\ :code:`
`\\ + :code:`
`Note that any truncated number of results queried via ``$top`` may also not be + compatible when using a filter.\\ :code:`
`\\ :code:`
`\\ :code:`
`Resources can be + filtered by tag names and values. For example, to filter for a tag name and value, use + ``$filter=tagName eq 'tag1' and tagValue eq 'Value1'``. Note that when resources are filtered + by tag name and value, :code:`the original tags for each resource will not be returned in + the results.` Any list of additional properties queried via ``$expand`` may also not be + compatible when filtering by tag names/values. :code:`
`\\ :code:`
`For tag names only, + resources can be filtered by prefix using the following syntax: ``$filter=startswith(tagName, + 'depart')``. This query will return all resources with a tag name prefixed by the phrase + ``depart`` (i.e.\\ ``department``\\ , ``departureDate``\\ , ``departureTime``\\ , etc.)\\ + :code:`
`\\ :code:`
`\\ :code:`
`Note that some properties can be combined when + filtering resources, which include the following: ``substringof() and/or resourceType``\\ , + ``plan and plan/publisher and plan/name``\\ , and ``identity and identity/principalId``. + Default value is None. + :type filter: str + :param expand: Comma-separated list of additional properties to be included in the response. + Valid values include ``createdTime``\\ , ``changedTime`` and ``provisioningState``. For + example, ``$expand=createdTime,changedTime``. Default value is None. + :type expand: str + :param top: The number of recommendations per page if a paged version of this API is being + used. Default value is None. + :type top: int + :return: An iterator like instance of either GenericResourceExpanded or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResourceExpanded] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resources_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + expand=expand, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def check_existence( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> bool: + """Checks whether a resource exists. + + :param resource_group_name: The name of the resource group containing the resource to check. + The name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The resource provider of the resource to check. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type. Required. + :type resource_type: str + :param resource_name: The name of the resource to check whether it exists. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resources_check_existence_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _delete_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resources_delete_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes a resource. + + :param resource_group_name: The name of the resource group that contains the resource to + delete. The name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type. Required. + :type resource_type: str + :param resource_name: The name of the resource to delete. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_create_or_update_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Creates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to create. Required. + :type resource_type: str + :param resource_name: The name of the resource to create. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for creating or updating the resource. Is either a + GenericResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_update_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + parameters: Union[_models.GenericResource, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource. + + :param resource_group_name: The name of the resource group for the resource. The name is case + insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource to update. Required. + :type resource_type: str + :param resource_name: The name of the resource to update. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Parameters for updating the resource. Is either a GenericResource type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get( + self, + resource_group_name: str, + resource_provider_namespace: str, + parent_resource_path: str, + resource_type: str, + resource_name: str, + api_version: str, + **kwargs: Any + ) -> _models.GenericResource: + """Gets a resource. + + :param resource_group_name: The name of the resource group containing the resource to get. The + name is case insensitive. Required. + :type resource_group_name: str + :param resource_provider_namespace: The namespace of the resource provider. Required. + :type resource_provider_namespace: str + :param parent_resource_path: The parent resource identity. Required. + :type parent_resource_path: str + :param resource_type: The resource type of the resource. Required. + :type resource_type: str + :param resource_name: The name of the resource to get. Required. + :type resource_name: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: GenericResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + + _request = build_resources_get_request( + resource_group_name=resource_group_name, + resource_provider_namespace=resource_provider_namespace, + parent_resource_path=parent_resource_path, + resource_type=resource_type, + resource_name=resource_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("GenericResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def check_existence_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> bool: + """Checks by ID whether a resource exists. This API currently works only for a limited set of + Resource providers. In the event that a Resource provider does not implement this API, ARM will + respond with a 405. The alternative then is to use the GET API to check for the existence of + the resource. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resources_check_existence_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + def _delete_by_id_initial(self, resource_id: str, api_version: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resources_delete_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_by_id_initial( + resource_id=resource_id, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _create_or_update_by_id_initial( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_create_or_update_by_id_request( + resource_id=resource_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_by_id( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Create a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Create or update resource parameters. Is either a GenericResource type or a + IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_by_id_initial( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "GenericResource") + + _request = build_resources_update_by_id_request( + resource_id=resource_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: _models.GenericResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_by_id( + self, + resource_id: str, + api_version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_by_id( + self, resource_id: str, api_version: str, parameters: Union[_models.GenericResource, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.GenericResource]: + """Updates a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :param parameters: Update resource parameters. Is either a GenericResource type or a IO[bytes] + type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource or + IO[bytes] + :return: An instance of LROPoller that returns either GenericResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_by_id_initial( + resource_id=resource_id, + api_version=api_version, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("GenericResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GenericResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenericResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_by_id(self, resource_id: str, api_version: str, **kwargs: Any) -> _models.GenericResource: + """Gets a resource by ID. + + :param resource_id: The fully qualified ID of the resource, including the resource name and + resource type. Use the format, + /subscriptions/{guid}/resourceGroups/{resource-group-name}/{resource-provider-namespace}/{resource-type}/{resource-name}. + Required. + :type resource_id: str + :param api_version: The API version to use for the operation. Required. + :type api_version: str + :return: GenericResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.GenericResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.GenericResource] = kwargs.pop("cls", None) + + _request = build_resources_get_by_id_request( + resource_id=resource_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("GenericResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ResourceGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`resource_groups` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def check_existence(self, resource_group_name: str, **kwargs: Any) -> bool: + """Checks whether a resource group exists. + + :param resource_group_name: The name of the resource group to check. The name is case + insensitive. Required. + :type resource_group_name: str + :return: bool or the result of cls(response) + :rtype: bool + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_resource_groups_check_existence_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [204, 404]: + 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, {}) # type: ignore + return 200 <= response.status_code <= 299 + + @overload + def create_or_update( + self, + resource_group_name: str, + parameters: _models.ResourceGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, resource_group_name: str, parameters: Union[_models.ResourceGroup, IO[bytes]], **kwargs: Any + ) -> _models.ResourceGroup: + """Creates or updates a resource group. + + :param resource_group_name: The name of the resource group to create or update. Can include + alphanumeric, underscore, parentheses, hyphen, period (except at end), and Unicode characters + that match the allowed characters. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to the create or update a resource group. Is either a + ResourceGroup type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup or IO[bytes] + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGroup") + + _request = build_resource_groups_create_or_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, force_deletion_types: Optional[str] = None, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_resource_groups_delete_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + force_deletion_types=force_deletion_types, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["location"] = self._deserialize("str", response.headers.get("location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, force_deletion_types: Optional[str] = None, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a resource group. + + When you delete a resource group, all of its resources are also deleted. Deleting a resource + group deletes all of its template deployments and currently stored operations. + + :param resource_group_name: The name of the resource group to delete. The name is case + insensitive. Required. + :type resource_group_name: str + :param force_deletion_types: The resource types you want to force delete. Currently, only the + following is supported: + forceDeletionTypes=Microsoft.Compute/virtualMachines,Microsoft.Compute/virtualMachineScaleSets. + Default value is None. + :type force_deletion_types: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + force_deletion_types=force_deletion_types, + api_version=api_version, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, **kwargs: Any) -> _models.ResourceGroup: + """Gets a resource group. + + :param resource_group_name: The name of the resource group to get. The name is case + insensitive. Required. + :type resource_group_name: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + _request = build_resource_groups_get_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + parameters: _models.ResourceGroupPatchable, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupPatchable + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, resource_group_name: str, parameters: Union[_models.ResourceGroupPatchable, IO[bytes]], **kwargs: Any + ) -> _models.ResourceGroup: + """Updates a resource group. + + Resource groups can be updated through a simple PATCH operation to a group address. The format + of the request is the same as that for creating a resource group. If a field is unspecified, + the current value is retained. + + :param resource_group_name: The name of the resource group to update. The name is case + insensitive. Required. + :type resource_group_name: str + :param parameters: Parameters supplied to update a resource group. Is either a + ResourceGroupPatchable type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupPatchable or + IO[bytes] + :return: ResourceGroup or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroup] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ResourceGroupPatchable") + + _request = build_resource_groups_update_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("ResourceGroup", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _export_template_initial( + self, resource_group_name: str, parameters: Union[_models.ExportTemplateRequest, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "ExportTemplateRequest") + + _request = build_resource_groups_export_template_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_export_template( + self, + resource_group_name: str, + parameters: _models.ExportTemplateRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ResourceGroupExportResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_export_template( + self, resource_group_name: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either ResourceGroupExportResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_export_template( + self, resource_group_name: str, parameters: Union[_models.ExportTemplateRequest, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.ResourceGroupExportResult]: + """Captures the specified resource group as a template. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param parameters: Parameters for exporting the template. Is either a ExportTemplateRequest + type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.ExportTemplateRequest or + IO[bytes] + :return: An instance of LROPoller that returns either ResourceGroupExportResult or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroupExportResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ResourceGroupExportResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._export_template_initial( + resource_group_name=resource_group_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("ResourceGroupExportResult", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ResourceGroupExportResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ResourceGroupExportResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, filter: Optional[str] = None, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.ResourceGroup"]: + """Gets all the resource groups for a subscription. + + :param filter: The filter to apply on the operation.\\ :code:`
`\\ :code:`
`You can + filter by tag names and values. For example, to filter for a tag name and value, use + $filter=tagName eq 'tag1' and tagValue eq 'Value1'. Default value is None. + :type filter: str + :param top: The number of results to return. If null is passed, returns all resource groups. + Default value is None. + :type top: int + :return: An iterator like instance of either ResourceGroup or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.ResourceGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.ResourceGroupListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_resource_groups_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ResourceGroupListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + +class TagsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`tags` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def delete_value( # pylint: disable=inconsistent-return-statements + self, tag_name: str, tag_value: str, **kwargs: Any + ) -> None: + """Deletes a predefined tag value for a predefined tag name. + + This operation allows deleting a value from the list of predefined values for an existing + predefined tag name. The value being deleted must not be in use as a tag value for the given + tag name for any resource. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :param tag_value: The value of the tag to delete. Required. + :type tag_value: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_tags_delete_value_request( + tag_name=tag_name, + tag_value=tag_value, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def create_or_update_value(self, tag_name: str, tag_value: str, **kwargs: Any) -> _models.TagValue: + """Creates a predefined value for a predefined tag name. + + This operation allows adding a value to the list of predefined values for an existing + predefined tag name. A tag value can have a maximum of 256 characters. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :param tag_value: The value of the tag to create. Required. + :type tag_value: str + :return: TagValue or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagValue + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagValue] = kwargs.pop("cls", None) + + _request = build_tags_create_or_update_value_request( + tag_name=tag_name, + tag_value=tag_value, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("TagValue", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def create_or_update(self, tag_name: str, **kwargs: Any) -> _models.TagDetails: + """Creates a predefined tag name. + + This operation allows adding a name to the list of predefined tag names for the given + subscription. A tag name can have a maximum of 512 characters and is case-insensitive. Tag + names cannot have the following prefixes which are reserved for Azure use: 'microsoft', + 'azure', 'windows'. + + :param tag_name: The name of the tag to create. Required. + :type tag_name: str + :return: TagDetails or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagDetails] = kwargs.pop("cls", None) + + _request = build_tags_create_or_update_request( + tag_name=tag_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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) + + deserialized = self._deserialize("TagDetails", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def delete(self, tag_name: str, **kwargs: Any) -> None: # pylint: disable=inconsistent-return-statements + """Deletes a predefined tag name. + + This operation allows deleting a name from the list of predefined tag names for the given + subscription. The name being deleted must not be in use as a tag name for any resource. All + predefined values for the given name must have already been deleted. + + :param tag_name: The name of the tag. Required. + :type tag_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_tags_delete_request( + tag_name=tag_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **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, {}) # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.TagDetails"]: + """Gets a summary of tag usage under the subscription. + + This operation performs a union of predefined tags, resource tags, resource group tags and + subscription tags, and returns a summary of usage for each tag name and value under the given + subscription. In case of a large number of tags, this operation may return a previously cached + result. + + :return: An iterator like instance of either TagDetails or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.TagDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_tags_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("TagsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + def _create_or_update_at_scope_initial( + self, scope: str, parameters: Union[_models.TagsResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsResource") + + _request = build_tags_create_or_update_at_scope_request( + scope=scope, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update_at_scope( + self, scope: str, parameters: _models.TagsResource, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update_at_scope( + self, scope: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update_at_scope( + self, scope: str, parameters: Union[_models.TagsResource, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Creates or updates the entire set of tags on a resource or subscription. + + This operation allows adding or replacing the entire set of tags on the specified resource or + subscription. The specified entity can have a maximum of 50 tags. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Is either a TagsResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource or IO[bytes] + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_at_scope_initial( + scope=scope, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TagsResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.TagsResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.TagsResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_at_scope_initial( + self, scope: str, parameters: Union[_models.TagsPatchResource, IO[bytes]], **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "TagsPatchResource") + + _request = build_tags_update_at_scope_request( + scope=scope, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update_at_scope( + self, + scope: str, + parameters: _models.TagsPatchResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update_at_scope( + self, scope: str, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update_at_scope( + self, scope: str, parameters: Union[_models.TagsPatchResource, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.TagsResource]: + """Selectively updates the set of tags on a resource or subscription. + + This operation allows replacing, merging or selectively deleting tags on the specified resource + or subscription. The specified entity can have a maximum of 50 tags at the end of the + operation. The 'replace' option replaces the entire set of existing tags with a new set. The + 'merge' option allows adding tags with new names and updating the values of tags with existing + names. The 'delete' option allows selectively deleting tags based on given names or name/value + pairs. + + :param scope: The resource scope. Required. + :type scope: str + :param parameters: Is either a TagsPatchResource type or a IO[bytes] type. Required. + :type parameters: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsPatchResource or + IO[bytes] + :return: An instance of LROPoller that returns either TagsResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_at_scope_initial( + scope=scope, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize("TagsResource", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.TagsResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.TagsResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get_at_scope(self, scope: str, **kwargs: Any) -> _models.TagsResource: + """Gets the entire set of tags on a resource or subscription. + + Gets the entire set of tags on a resource or subscription. + + :param scope: The resource scope. Required. + :type scope: str + :return: TagsResource or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.TagsResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.TagsResource] = kwargs.pop("cls", None) + + _request = build_tags_get_at_scope_request( + scope=scope, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("TagsResource", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_at_scope_initial(self, scope: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_tags_delete_at_scope_request( + scope=scope, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete_at_scope(self, scope: str, **kwargs: Any) -> LROPoller[None]: + """Deletes the entire set of tags on a resource or subscription. + + Deletes the entire set of tags on a resource or subscription. + + :param scope: The resource scope. Required. + :type scope: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_at_scope_initial( + scope=scope, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class DeploymentOperationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.resource.resources.v2025_03_01.ResourceManagementClient`'s + :attr:`deployment_operations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ResourceManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") + + @distributed_trace + def get_at_scope( + self, scope: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_scope_request( + scope=scope, + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_scope( + self, scope: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param scope: The resource scope. Required. + :type scope: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_scope_request( + scope=scope, + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def get_at_tenant_scope( + self, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_tenant_scope_request( + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_tenant_scope( + self, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_tenant_scope_request( + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def get_at_management_group_scope( + self, group_id: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + operation_id=operation_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_management_group_scope( + self, group_id: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param group_id: The management group ID. Required. + :type group_id: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_management_group_scope_request( + group_id=group_id, + deployment_name=deployment_name, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def get_at_subscription_scope( + self, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_at_subscription_scope_request( + deployment_name=deployment_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_at_subscription_scope( + self, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_at_subscription_scope_request( + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) + + @distributed_trace + def get( + self, resource_group_name: str, deployment_name: str, operation_id: str, **kwargs: Any + ) -> _models.DeploymentOperation: + """Gets a deployments operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param operation_id: The ID of the operation to get. Required. + :type operation_id: str + :return: DeploymentOperation or the result of cls(response) + :rtype: ~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperation] = kwargs.pop("cls", None) + + _request = build_deployment_operations_get_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + operation_id=operation_id, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = 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("DeploymentOperation", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, deployment_name: str, top: Optional[int] = None, **kwargs: Any + ) -> Iterable["_models.DeploymentOperation"]: + """Gets all deployments operations for a deployment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param deployment_name: The name of the deployment. Required. + :type deployment_name: str + :param top: The number of results to return. Default value is None. + :type top: int + :return: An iterator like instance of either DeploymentOperation or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.resource.resources.v2025_03_01.models.DeploymentOperation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2025-03-01")) + cls: ClsType[_models.DeploymentOperationsListResult] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_deployment_operations_list_request( + resource_group_name=resource_group_name, + deployment_name=deployment_name, + subscription_id=self._config.subscription_id, + top=top, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeploymentOperationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = 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) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_patch.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_patch.py new file mode 100644 index 000000000000..8bcb627aa475 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/operations/_patch.py @@ -0,0 +1,21 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# -------------------------------------------------------------------------- +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/py.typed b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2025_03_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py index a94487cbf17a..05bcd7d403ae 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_serialization.py @@ -1,28 +1,4 @@ -# -------------------------------------------------------------------------- -# -# 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. -# -# -------------------------------------------------------------------------- +# coding=utf-8 # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -47,9 +23,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -60,13 +34,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -184,73 +158,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -478,8 +386,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -625,7 +533,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -735,8 +643,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -780,8 +688,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -804,8 +712,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -834,8 +742,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -854,9 +762,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1191,7 +1099,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1217,7 +1125,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1250,7 +1158,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1428,7 +1336,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1487,7 +1395,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1501,7 +1409,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1716,7 +1624,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1798,7 +1706,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1844,7 +1752,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1935,7 +1843,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1948,7 +1856,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1963,7 +1871,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1981,7 +1889,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1994,7 +1902,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2012,7 +1920,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2028,7 +1936,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2043,14 +1951,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2066,7 +1974,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2104,7 +2012,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py index 2fbbb565665e..cd978cd70605 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_subscription_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -67,13 +69,18 @@ def __init__( self, credential: "TokenCredential", api_version: Optional[str]=None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles=KnownProfiles.default, **kwargs: Any ): if api_version: kwargs.setdefault('api_version', api_version) - self._config = SubscriptionClientConfiguration(credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration(credential, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +99,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(SubscriptionClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_subscription_client.py index 56d66a4e6312..cf38c9456468 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/aio/_subscription_client.py @@ -9,12 +9,14 @@ # regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from azure.profiles import KnownProfiles, ProfileDefinition from azure.profiles.multiapiclient import MultiApiClientMixin @@ -28,7 +30,7 @@ class _SDKClient(object): def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." + """This is a fake class to support current implementation of MultiApiClientMixin." Will be removed in final version of multiapi azure-core based client """ pass @@ -67,13 +69,18 @@ def __init__( self, credential: "AsyncTokenCredential", api_version: Optional[str] = None, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: if api_version: kwargs.setdefault('api_version', api_version) - self._config = SubscriptionClientConfiguration(credential, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration(credential, credential_scopes=credential_scopes, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -92,7 +99,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) super(SubscriptionClient, self).__init__( api_version=api_version, profile=profile diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json index 3d877180fa57..0b68ffeb55b7 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py index b49fd3989e6f..2c31aa461ebb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,17 +40,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2016_06_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py index 3cebdbfb50e4..5e8485aaa24d 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,17 +41,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2016_06_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2016-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py index de58785fb405..53fa7ba64532 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_subscription_check_resource_name_request, @@ -36,12 +39,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +60,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -155,10 +155,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -490,15 +490,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py index 87fc63c59f30..af914a1c95d2 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/models/_models_py3.py @@ -40,7 +40,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -155,7 +155,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2016_06_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -184,8 +184,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDefinition(_serialization.Model): @@ -251,11 +251,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -340,12 +340,12 @@ class Location(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.latitude = None - self.longitude = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.display_name: Optional[str] = None + self.latitude: Optional[str] = None + self.longitude: Optional[str] = None class LocationListResult(_serialization.Model): @@ -495,8 +495,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -589,10 +589,10 @@ def __init__( :paramtype authorization_source: str """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source @@ -661,9 +661,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -691,8 +691,8 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py index 34062bcf3ee5..f9ea13a8c341 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2016_06_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -212,10 +210,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -307,10 +305,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -642,10 +640,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json index 7430db3024b3..234dd7ee67f1 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py index ee297575a3c0..e051817aba58 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,17 +40,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2018_06_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py index dd45c5bc8ef2..de539c637035 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,17 +41,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2018_06_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2018-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py index c8930b14aac4..ae03cc713835 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_subscription_check_resource_name_request, @@ -36,12 +39,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +60,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -155,10 +155,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -490,15 +490,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py index 9f56ac4fcafc..74d54195e7f9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/models/_models_py3.py @@ -40,7 +40,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -155,7 +155,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2018_06_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -184,8 +184,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDefinition(_serialization.Model): @@ -251,11 +251,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -340,12 +340,12 @@ class Location(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.latitude = None - self.longitude = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.display_name: Optional[str] = None + self.latitude: Optional[str] = None + self.longitude: Optional[str] = None class LocationListResult(_serialization.Model): @@ -495,8 +495,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -593,11 +593,11 @@ def __init__( :paramtype authorization_source: str """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.tenant_id: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source @@ -666,9 +666,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -712,12 +712,12 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.country: Optional[str] = None + self.country_code: Optional[str] = None + self.display_name: Optional[str] = None + self.domains: Optional[List[str]] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py index ab51db945f54..8b8b61944fd9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2018_06_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -212,10 +210,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -307,10 +305,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -642,10 +640,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json index 916f096c418b..57e839ca8ac8 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py index d9faab997fd8..56fee63b4c06 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,17 +40,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2019_06_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py index ef563b6f6d7c..394d6e3f1cbb 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,17 +41,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2019_06_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py index 14d6b6eb6b58..07af3084a6f4 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_subscription_check_resource_name_request, @@ -36,12 +39,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +60,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -155,10 +155,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -490,15 +490,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py index 853195e101df..0155b010eb71 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/models/_models_py3.py @@ -40,7 +40,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -155,7 +155,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -184,8 +184,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDefinition(_serialization.Model): @@ -251,11 +251,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -340,12 +340,12 @@ class Location(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.latitude = None - self.longitude = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.display_name: Optional[str] = None + self.latitude: Optional[str] = None + self.longitude: Optional[str] = None class LocationListResult(_serialization.Model): @@ -388,7 +388,7 @@ class ManagedByTenant(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.tenant_id = None + self.tenant_id: Optional[str] = None class Operation(_serialization.Model): @@ -518,8 +518,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -624,11 +624,11 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2019_06_01.models.ManagedByTenant] """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.tenant_id: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source self.managed_by_tenants = managed_by_tenants @@ -698,9 +698,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -750,13 +750,13 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.tenant_category: Optional[Union[str, "_models.TenantCategory"]] = None + self.country: Optional[str] = None + self.country_code: Optional[str] = None + self.display_name: Optional[str] = None + self.domains: Optional[List[str]] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py index e47535a748b0..16a88e870d4f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_06_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -212,10 +210,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -307,10 +305,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -642,10 +640,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json index 9ab19bf3a1ef..6aae49fac655 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py index 5620b9d16866..5193e246dcf9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,17 +40,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2019_11_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py index 3432a723a6d2..036848593769 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,17 +41,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2019_11_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2019-11-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py index 9eeae2aae08e..3f865e7ac9c5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_subscription_check_resource_name_request, @@ -36,12 +39,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +60,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -155,10 +155,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -490,15 +490,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py index 406ef39ce721..84bb99cfe69c 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/models/_models_py3.py @@ -40,7 +40,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -155,7 +155,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -184,8 +184,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDefinition(_serialization.Model): @@ -251,11 +251,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -342,11 +342,11 @@ def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **k :paramtype metadata: ~azure.mgmt.resource.subscriptions.v2019_11_01.models.LocationMetadata """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.display_name = None - self.regional_display_name = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.display_name: Optional[str] = None + self.regional_display_name: Optional[str] = None self.metadata = metadata @@ -419,12 +419,12 @@ def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = No list[~azure.mgmt.resource.subscriptions.v2019_11_01.models.PairedRegion] """ super().__init__(**kwargs) - self.region_type = None - self.region_category = None - self.geography_group = None - self.longitude = None - self.latitude = None - self.physical_location = None + self.region_type: Optional[Union[str, "_models.RegionType"]] = None + self.region_category: Optional[Union[str, "_models.RegionCategory"]] = None + self.geography_group: Optional[str] = None + self.longitude: Optional[str] = None + self.latitude: Optional[str] = None + self.physical_location: Optional[str] = None self.paired_region = paired_region @@ -448,7 +448,7 @@ class ManagedByTenant(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.tenant_id = None + self.tenant_id: Optional[str] = None class Operation(_serialization.Model): @@ -583,9 +583,9 @@ class PairedRegion(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.id = None - self.subscription_id = None + self.name: Optional[str] = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None class Peers(_serialization.Model): @@ -612,8 +612,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -724,11 +724,11 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.tenant_id: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source self.managed_by_tenants = managed_by_tenants @@ -799,9 +799,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -851,13 +851,13 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.tenant_category: Optional[Union[str, "_models.TenantCategory"]] = None + self.country: Optional[str] = None + self.country_code: Optional[str] = None + self.display_name: Optional[str] = None + self.domains: Optional[List[str]] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py index 856f31679ecd..676f8c74cc72 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2019_11_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -212,10 +210,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -307,10 +305,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -642,10 +640,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json index 1adecbf7fda2..ef16201a6e22 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py index 5af1a6f1df0f..a62fc5eab598 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -36,17 +38,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2021_01_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -65,7 +73,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py index d9dce62cc737..ecf5c29073b6 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -37,17 +39,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2021_01_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2021-01-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -66,7 +74,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py index 516c1e408045..f825d17f5f16 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_subscription_check_resource_name_request, build_subscriptions_check_zone_peers_request, @@ -35,12 +38,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -59,10 +59,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -400,15 +400,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py index 90005bc2e068..b2e6505cb7e0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/models/_models_py3.py @@ -40,7 +40,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -155,7 +155,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -184,8 +184,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -225,11 +225,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -270,11 +270,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponseAutoGenerated(_serialization.Model): @@ -345,12 +345,12 @@ def __init__(self, *, metadata: Optional["_models.LocationMetadata"] = None, **k :paramtype metadata: ~azure.mgmt.resource.subscriptions.v2021_01_01.models.LocationMetadata """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.type = None - self.display_name = None - self.regional_display_name = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[Union[str, "_models.LocationType"]] = None + self.display_name: Optional[str] = None + self.regional_display_name: Optional[str] = None self.metadata = metadata @@ -428,14 +428,14 @@ def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = No list[~azure.mgmt.resource.subscriptions.v2021_01_01.models.PairedRegion] """ super().__init__(**kwargs) - self.region_type = None - self.region_category = None - self.geography_group = None - self.longitude = None - self.latitude = None - self.physical_location = None + self.region_type: Optional[Union[str, "_models.RegionType"]] = None + self.region_category: Optional[Union[str, "_models.RegionCategory"]] = None + self.geography_group: Optional[str] = None + self.longitude: Optional[str] = None + self.latitude: Optional[str] = None + self.physical_location: Optional[str] = None self.paired_region = paired_region - self.home_location = None + self.home_location: Optional[str] = None class ManagedByTenant(_serialization.Model): @@ -458,7 +458,7 @@ class ManagedByTenant(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.tenant_id = None + self.tenant_id: Optional[str] = None class Operation(_serialization.Model): @@ -593,9 +593,9 @@ class PairedRegion(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.id = None - self.subscription_id = None + self.name: Optional[str] = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None class Peers(_serialization.Model): @@ -622,8 +622,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -734,11 +734,11 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.tenant_id: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source self.managed_by_tenants = managed_by_tenants @@ -809,9 +809,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -874,16 +874,16 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None - self.default_domain = None - self.tenant_type = None - self.tenant_branding_logo_url = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.tenant_category: Optional[Union[str, "_models.TenantCategory"]] = None + self.country: Optional[str] = None + self.country_code: Optional[str] = None + self.display_name: Optional[str] = None + self.domains: Optional[List[str]] = None + self.default_domain: Optional[str] = None + self.tenant_type: Optional[str] = None + self.tenant_branding_logo_url: Optional[str] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py index 097092f7a14d..11b784b67832 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2021_01_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -197,10 +195,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -538,10 +536,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_metadata.json b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_metadata.json index 49ebf7824548..bf0d0e5c995a 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_metadata.json +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_metadata.json @@ -5,13 +5,13 @@ "name": "SubscriptionClient", "filename": "_subscription_client", "description": "All resource groups and resources exist within subscriptions. These operation enable you get information about your subscriptions and tenants. A tenant is a dedicated instance of Azure Active Directory (Azure AD) for your organization.", - "host_value": "\"https://management.azure.com\"", + "host_value": null, "parameterized_host_template": null, "azure_arm": true, "has_public_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.core.settings\": [\"settings\"], \"azure.mgmt.core.tools\": [\"get_arm_endpoints\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"stdlib\": {\"typing\": [\"Optional\", \"cast\"], \"typing_extensions\": [\"Self\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"], \"._operations_mixin\": [\"SubscriptionClientOperationsMixin\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "global_parameters": { "sync": { @@ -44,7 +44,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, @@ -67,7 +67,7 @@ "method_location": "positional" }, "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", + "signature": "base_url: Optional[str] = None,", "description": "Service URL", "docstring_type": "str", "required": false, diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_subscription_client.py index fa41ba11f01d..58bdd26cc6fd 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from .._serialization import Deserializer, Serializer @@ -38,17 +40,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): :vartype tenants: azure.mgmt.resource.subscriptions.v2022_12_01.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "TokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "TokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -67,7 +75,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/_subscription_client.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/_subscription_client.py index aa00bbcabecd..f1557417508f 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/_subscription_client.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/_subscription_client.py @@ -7,13 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from ..._serialization import Deserializer, Serializer @@ -39,17 +41,23 @@ class SubscriptionClient(SubscriptionClientOperationsMixin): azure.mgmt.resource.subscriptions.v2022_12_01.aio.operations.TenantsOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str :keyword api_version: Api Version. Default value is "2022-12-01". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__( - self, credential: "AsyncTokenCredential", base_url: str = "https://management.azure.com", **kwargs: Any - ) -> None: - self._config = SubscriptionClientConfiguration(credential=credential, **kwargs) + def __init__(self, credential: "AsyncTokenCredential", base_url: Optional[str] = None, **kwargs: Any) -> None: + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SubscriptionClientConfiguration( + credential=credential, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -68,7 +76,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/operations/_operations.py index a6654b0b82d9..cd36d7ea3faa 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,11 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -27,6 +29,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models +from ...._serialization import Deserializer, Serializer from ...operations._operations import ( build_operations_list_request, build_subscription_check_resource_name_request, @@ -36,12 +39,9 @@ build_subscriptions_list_request, build_tenants_list_request, ) +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -60,10 +60,10 @@ class Operations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -155,10 +155,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -496,15 +496,14 @@ class TenantsOperations: def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.TenantIdDescription"]: - # pylint: disable=line-too-long """Gets the tenants for your account. :return: An iterator like instance of either TenantIdDescription or the result of cls(response) diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/models/_models_py3.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/models/_models_py3.py index ac4e44d3c637..4c00a5dd20a5 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/models/_models_py3.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/models/_models_py3.py @@ -40,8 +40,8 @@ class AvailabilityZoneMappings(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.logical_zone = None - self.physical_zone = None + self.logical_zone: Optional[str] = None + self.physical_zone: Optional[str] = None class AvailabilityZonePeers(_serialization.Model): @@ -70,7 +70,7 @@ def __init__(self, *, peers: Optional[List["_models.Peers"]] = None, **kwargs: A :paramtype peers: list[~azure.mgmt.resource.subscriptions.v2022_12_01.models.Peers] """ super().__init__(**kwargs) - self.availability_zone = None + self.availability_zone: Optional[str] = None self.peers = peers @@ -185,7 +185,7 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2022_12_01.models.AvailabilityZonePeers] """ super().__init__(**kwargs) - self.subscription_id = None + self.subscription_id: Optional[str] = None self.location = location self.availability_zone_peers = availability_zone_peers @@ -214,8 +214,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -255,11 +255,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -300,11 +300,11 @@ class ErrorResponse(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorResponse"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponseAutoGenerated(_serialization.Model): @@ -388,12 +388,12 @@ def __init__( list[~azure.mgmt.resource.subscriptions.v2022_12_01.models.AvailabilityZoneMappings] """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.name = None - self.type = None - self.display_name = None - self.regional_display_name = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[Union[str, "_models.LocationType"]] = None + self.display_name: Optional[str] = None + self.regional_display_name: Optional[str] = None self.metadata = metadata self.availability_zone_mappings = availability_zone_mappings @@ -476,15 +476,15 @@ def __init__(self, *, paired_region: Optional[List["_models.PairedRegion"]] = No list[~azure.mgmt.resource.subscriptions.v2022_12_01.models.PairedRegion] """ super().__init__(**kwargs) - self.region_type = None - self.region_category = None - self.geography = None - self.geography_group = None - self.longitude = None - self.latitude = None - self.physical_location = None + self.region_type: Optional[Union[str, "_models.RegionType"]] = None + self.region_category: Optional[Union[str, "_models.RegionCategory"]] = None + self.geography: Optional[str] = None + self.geography_group: Optional[str] = None + self.longitude: Optional[str] = None + self.latitude: Optional[str] = None + self.physical_location: Optional[str] = None self.paired_region = paired_region - self.home_location = None + self.home_location: Optional[str] = None class ManagedByTenant(_serialization.Model): @@ -507,7 +507,7 @@ class ManagedByTenant(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.tenant_id = None + self.tenant_id: Optional[str] = None class Operation(_serialization.Model): @@ -553,11 +553,11 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.resource.subscriptions.v2022_12_01.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None - self.is_data_action = None + self.name: Optional[str] = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationAutoGenerated(_serialization.Model): @@ -612,10 +612,10 @@ def __init__( """ super().__init__(**kwargs) self.name = name - self.is_data_action = None + self.is_data_action: Optional[bool] = None self.display = display - self.origin = None - self.action_type = None + self.origin: Optional[Union[str, "_models.Origin"]] = None + self.action_type: Optional[Union[str, "_models.ActionType"]] = None class OperationDisplay(_serialization.Model): @@ -654,10 +654,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None + self.operation: Optional[str] = None + self.description: Optional[str] = None class OperationDisplayAutoGenerated(_serialization.Model): @@ -731,8 +731,8 @@ class OperationListResult(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.value = None - self.next_link = None + self.value: Optional[List["_models.Operation"]] = None + self.next_link: Optional[str] = None class OperationListResultAutoGenerated(_serialization.Model): @@ -799,9 +799,9 @@ class PairedRegion(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name = None - self.id = None - self.subscription_id = None + self.name: Optional[str] = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None class Peers(_serialization.Model): @@ -828,8 +828,8 @@ class Peers(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.subscription_id = None - self.availability_zone = None + self.subscription_id: Optional[str] = None + self.availability_zone: Optional[str] = None class ResourceName(_serialization.Model): @@ -940,11 +940,11 @@ def __init__( :paramtype tags: dict[str, str] """ super().__init__(**kwargs) - self.id = None - self.subscription_id = None - self.display_name = None - self.tenant_id = None - self.state = None + self.id: Optional[str] = None + self.subscription_id: Optional[str] = None + self.display_name: Optional[str] = None + self.tenant_id: Optional[str] = None + self.state: Optional[Union[str, "_models.SubscriptionState"]] = None self.subscription_policies = subscription_policies self.authorization_source = authorization_source self.managed_by_tenants = managed_by_tenants @@ -1015,9 +1015,9 @@ class SubscriptionPolicies(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.location_placement_id = None - self.quota_id = None - self.spending_limit = None + self.location_placement_id: Optional[str] = None + self.quota_id: Optional[str] = None + self.spending_limit: Optional[Union[str, "_models.SpendingLimit"]] = None class TenantIdDescription(_serialization.Model): @@ -1080,16 +1080,16 @@ class TenantIdDescription(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.tenant_id = None - self.tenant_category = None - self.country = None - self.country_code = None - self.display_name = None - self.domains = None - self.default_domain = None - self.tenant_type = None - self.tenant_branding_logo_url = None + self.id: Optional[str] = None + self.tenant_id: Optional[str] = None + self.tenant_category: Optional[Union[str, "_models.TenantCategory"]] = None + self.country: Optional[str] = None + self.country_code: Optional[str] = None + self.display_name: Optional[str] = None + self.domains: Optional[List[str]] = None + self.default_domain: Optional[str] = None + self.tenant_type: Optional[str] = None + self.tenant_branding_logo_url: Optional[str] = None class TenantListResult(_serialization.Model): diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/operations/_operations.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/operations/_operations.py index 3e0c2d75c2f6..e500c92286d0 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/operations/_operations.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/subscriptions/v2022_12_01/operations/_operations.py @@ -5,11 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -import sys from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -26,13 +27,10 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from ..._serialization import Deserializer, Serializer +from .._configuration import SubscriptionClientConfiguration from .._vendor import SubscriptionClientMixinABC -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -216,10 +214,10 @@ class Operations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -311,10 +309,10 @@ class SubscriptionsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace @@ -652,10 +650,10 @@ class TenantsOperations: def __init__(self, *args, **kwargs): input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SubscriptionClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py index bd832a80d1ed..1ffd23508add 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2019_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_03_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2021_05_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py index afe3b3f60b64..e13c9711e3d9 100644 --- a/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py +++ b/sdk/resources/azure-mgmt-resource/azure/mgmt/resource/templatespecs/v2022_02_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "23.3.0" +VERSION = "23.4.0" diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/changes/get_change.py b/sdk/resources/azure-mgmt-resource/generated_samples/changes/get_change.py index d05e9265c429..5e31f10bd849 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/changes/get_change.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/changes/get_change.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ChangesClient +from azure.mgmt.resource.changes import ChangesClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/changes/list_changes.py b/sdk/resources/azure-mgmt-resource/generated_samples/changes/list_changes.py index ae9967be94c5..2a5eecaccddd 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/changes/list_changes.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/changes/list_changes.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ChangesClient +from azure.mgmt.resource.changes import ChangesClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_scoped_data_boundary.py b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_scoped_data_boundary.py index 9ef9cb66a13f..b9cb5560637f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_scoped_data_boundary.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_scoped_data_boundary.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DataBoundaryMgmtClient +from azure.mgmt.resource.databoundaries import DataBoundaryMgmtClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_tenant_data_boundary.py b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_tenant_data_boundary.py index 11c050c6ed20..9df50f89cc25 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_tenant_data_boundary.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/get_tenant_data_boundary.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DataBoundaryMgmtClient +from azure.mgmt.resource.databoundaries import DataBoundaryMgmtClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/put_data_boundary.py b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/put_data_boundary.py index 83a8738eea0a..d4a292bf6685 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/put_data_boundary.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/databoundaries/put_data_boundary.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DataBoundaryMgmtClient +from azure.mgmt.resource.databoundaries import DataBoundaryMgmtClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create.py index e2525d573ea4..84ab54234410 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_no_user_managed_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_no_user_managed_identity.py index 6bf02d81f152..8046b6a7f9a6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_no_user_managed_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_no_user_managed_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name.py index bf4e406d0005..1648e7a68b1a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name_with_subnet_ids.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name_with_subnet_ids.py index 93d61de603d7..3481dfe84338 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name_with_subnet_ids.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_custom_aci_name_with_subnet_ids.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_existing_storage_account.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_existing_storage_account.py index 0b34d5ba91b5..1ac3df108948 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_existing_storage_account.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_create_using_existing_storage_account.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_delete.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_delete.py index 40f0ca869dcb..6a316faa3eae 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_delete.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get.py index f475e441c5a9..3e665a134842 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs.py index 4c6fe885e374..852c337ff12e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default.py index f55121f99508..86b68ad9ca03 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default_with_tail.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default_with_tail.py index a6c2baaca19e..1127640608cf 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default_with_tail.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_get_logs_default_with_tail.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_resource_group.py index 1637d59cb108..3fc0b0808069 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_subscription.py index de43bc5bc57b..510646a61101 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_list_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_min_create.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_min_create.py index f8920e37902c..05796887b256 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_min_create.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_min_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_update.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_update.py index d9ff1bffd510..ef587548eac7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_update.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentscripts/deployment_scripts_update.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts import DeploymentScriptsClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_export_template.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_export_template.py index 8f7ebd1cde31..0fd65bb591ec 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_export_template.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_export_template.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_create.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_create.py index 84759e03049b..a03a8993c795 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_create.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_delete.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_delete.py index dc4f485467a5..0adcbeead994 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_delete.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_export_template.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_export_template.py index 0b44267b2aa4..c490b74562d4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_export_template.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_export_template.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_get.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_get.py index d413dd1d532c..901001dbaa50 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_get.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_list.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_list.py index 4769ff755c27..2cdb9e039d5e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_list.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_validate.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_validate.py index 5bb2418f28b9..43e7bd1a2034 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_validate.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_management_group_validate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_create.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_create.py index c93b0abaaab7..adc69d1ff20b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_create.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_delete.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_delete.py index 806f5313b3d8..d91d9ef0abff 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_delete.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_get.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_get.py index 793b67377d58..9ea2a39aad13 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_get.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_list.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_list.py index ad0b37a006b3..8431bf40ab99 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_list.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_validate.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_validate.py index 9f92cb4af23b..6cbf99f14e58 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_validate.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_resource_group_validate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_create.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_create.py index f5befb0f3b13..770309aa38bf 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_create.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_create.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_delete.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_delete.py index afb36fc907f4..4d2d98c12468 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_delete.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_export_template.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_export_template.py index 92dc45dda5d5..9175d02fcfb9 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_export_template.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_export_template.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_get.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_get.py index 68e58e03ffc6..6faad2d2d3b7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_get.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_list.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_list.py index b03ce84353a6..e7a339523583 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_list.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_validate.py b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_validate.py index c85504d0ebb0..8cacbbc5e21a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_validate.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/deploymentstacks/deployment_stack_subscription_validate.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks import DeploymentStacksClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_delete.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_delete.py index b8f6dc568d84..b26a4327f751 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_delete.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_delete.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_get.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_get.py index 51284d4ef921..2933da7e33a4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_get.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_get.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_list.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_list.py index 0f1b2c62f8e1..663b1880ef09 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_list.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_list.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_listall.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_listall.py index bef0c0035d1b..2480718e3f7a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_listall.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_listall.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_put.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_put.py index 14db31a5e3da..0dae2bc962ec 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_put.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/feature_registration/subscription_feature_registration_put.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/get_feature.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/get_feature.py index 46d1ac2d61b5..138d09ea65c2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/get_feature.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/get_feature.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_features_operations.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_features_operations.py index a8529b8e1129..e848c80d1129 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_features_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_features_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_provider_features.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_provider_features.py index 8a8d8c91fff9..345d9640f23d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_provider_features.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_provider_features.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_subscription_features.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_subscription_features.py index 173e5ae05fa2..7e7d6dd32711 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/list_subscription_features.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/list_subscription_features.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/register_feature.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/register_feature.py index d2a8bc254ec5..8176386f03ef 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/register_feature.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/register_feature.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/features/unregister_feature.py b/sdk/resources/azure-mgmt-resource/generated_samples/features/unregister_feature.py index 889bf8313134..c825de583f98 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/features/unregister_feature.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/features/unregister_feature.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features import FeatureClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/list_provider_operations.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/list_provider_operations.py index 8eb97a9b7ffc..c213122b299b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/list_provider_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/list_provider_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_group_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_group_level.py index 6a0805b2559f..335b17e362df 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_group_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_group_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_level.py index ea41643512e3..b07c056ee896 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_scope.py index ca84fce1497e..e152638e3e62 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_subscription_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_subscription_level.py index a96f67187939..30eedef0d32a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_subscription_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_create_or_update_at_subscription_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_group_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_group_level.py index 99697b4afb3d..52ef58c437d8 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_group_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_group_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_level.py index 5eeeffddb297..c498141e6273 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_scope.py index f20fcecdab40..a69e6238a9b4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_subscription_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_subscription_level.py index 3ab041e7b495..d678d21c874d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_subscription_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_delete_at_subscription_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_group_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_group_level.py index d855e4f8b41a..e378f4146848 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_group_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_group_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_level.py index 1d668f089241..8c6a22154892 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_scope.py index fc78d10d17ec..ca50563039e2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_subscription_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_subscription_level.py index 49734a6827dd..f772e9332237 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_subscription_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_get_at_subscription_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_group_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_group_level.py index 286d5f2c9960..a12263206cc2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_group_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_group_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_level.py index 281874f1911b..c0bc2f7cbea6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_resource_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_scope.py index 29b0eccf9625..6539d6327a54 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_subscription_level.py b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_subscription_level.py index 09ec250c1cf0..9a7f51b83c6b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_subscription_level.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/locks/management_locks_list_at_subscription_level.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks import ManagementLockClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application.py index 0d5f6a6e202b..74e93150ebfe 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application_definition.py index 99786c441317..d6ce15758ea3 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/create_or_update_application_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES @@ -30,7 +31,7 @@ def main(): subscription_id="subid", ) - response = client.application_definitions.begin_create_or_update_by_id( + response = client.application_definitions.begin_create_or_update( resource_group_name="rg", application_definition_name="myManagedApplicationDef", parameters={ diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/delete_application_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/delete_application_definition.py index 938fd32e8110..b5e88b527e4e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/delete_application_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/delete_application_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application.py index 708cf678ff45..3dd4f98a533c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application_definition.py index cf2a5d3e017f..8289a3fdc0e4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/get_application_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES @@ -30,7 +31,7 @@ def main(): subscription_id="subid", ) - response = client.application_definitions.get_by_id( + response = client.application_definitions.get( resource_group_name="rg", application_definition_name="myManagedApplicationDef", ) diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_application_definitions_by_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_application_definitions_by_resource_group.py index b0f50fa45bfe..6f79996e5b36 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_application_definitions_by_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_application_definitions_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_applications_by_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_applications_by_resource_group.py index c238297a7640..754f51c11a4f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_applications_by_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_applications_by_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_solutions_operations.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_solutions_operations.py index 574418fa64a9..6187adc8ccd5 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_solutions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/list_solutions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/update_application.py b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/update_application.py index c9150793eec2..fd7454a41bbd 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/update_application.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/managedapplications/update_application.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications import ApplicationClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition.py index 08671428f800..f4d82bc507d6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_advanced_params.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_advanced_params.py index 88bfa62f5aa2..318ba57e2df7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_advanced_params.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_advanced_params.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_at_management_group.py index 62054621b10d..67b904cf2413 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version.py index f89376f97800..44becf8b972e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version_at_management_group.py index 1e8e0de47284..6d639b2f867b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition.py index 92699988ada4..354b54f5ea96 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_at_management_group.py index 4b529099af86..c75448b67665 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version.py index 9526597a8897..eab3aed03cb9 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version_at_management_group.py index 9e7158356674..6b34288fb4ec 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups.py index 330ab1824643..dbfbf078adac 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups_at_management_group.py index b230e26bf40a..589300e0c744 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_or_update_policy_set_definition_with_groups_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment.py index c54d0c81cb24..7ce186b80b85 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_by_id.py index dc46d978a435..5b07700987a1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_non_compliance_messages.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_non_compliance_messages.py index 591bd34b8c00..c8aa6a2c615f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_non_compliance_messages.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_non_compliance_messages.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity.py index 53911bc8606a..f489c1a5607d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity_by_id.py index 245e4d8be0f8..48eb29c1a37c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_identity_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_overrides.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_overrides.py index 20534efd901d..44795486fc66 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_overrides.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_overrides.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_resource_selectors.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_resource_selectors.py index 4b2e25f6eb20..e1576d01e37a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_resource_selectors.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_resource_selectors.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_user_assigned_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_user_assigned_identity.py index 41b113ddbf4b..92af0ab539a5 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_user_assigned_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_with_user_assigned_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_without_enforcement.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_without_enforcement.py index abfe37a9e4b3..a67228ed5032 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_without_enforcement.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/create_policy_assignment_without_enforcement.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment.py index 1c39467d74a8..bc403a338da3 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment_by_id.py index 61c827ed9ac6..cf0d85ba91e5 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_assignment_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition.py index 117a3f5f25ba..72e7bdf33e71 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_at_management_group.py index 7fbfbe54316e..5a9fa553adee 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version.py index f3715765299a..f4e20dbd111f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version_at_management_group.py index 45ede5327e14..4703cbac4369 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition.py index 9c1d36b6d2d0..5db264528e83 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_at_management_group.py index 20d0aaaaa7a8..1ae8a6aef702 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version.py index 4553f6fee836..e11c5fb86c2b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version_at_management_group.py index 935ff2d6868e..6d90538ca979 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/delete_policy_set_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition.py index 9af4b397e53e..d830ae62d364 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition_version.py index be129f6d6876..9ab7e9cf9e40 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_built_in_policy_set_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition.py index 3d29a8ec0023..c11c16a040d8 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition_version.py index f0d6ec55a562..5a0c37bb4f0b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_builtin_policy_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment.py index ac792d08c116..2c89c053d1f6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_by_id.py index 1efdfb29eef3..6e0bcfd61c10 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity.py index 5b425e69c28b..a0e6084a4acf 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity_by_id.py index fd40cc4ca112..2e984e58f73a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_identity_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_overrides.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_overrides.py index 660bc3028f89..a80ff5047a46 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_overrides.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_overrides.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_resource_selectors.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_resource_selectors.py index 84d86f3b3976..abbb9831a7b1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_resource_selectors.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_resource_selectors.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_user_assigned_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_user_assigned_identity.py index 070c3e2f7be5..69ccc1d587b4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_user_assigned_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_assignment_with_user_assigned_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition.py index 0480d070b277..914edda19d54 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_at_management_group.py index 2142aafc0c66..6bd860483442 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version.py index b6d8c95f1d75..686fd743e73d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version_at_management_group.py index 8d9b741b0f0b..8145cf5e10e4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition.py index ea45c8ae5ed2..3432e2f2fee4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_at_management_group.py index 1ac19e66a35d..847a2b90eb37 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version.py index 9dce379f432c..d2e9f8d8069c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version_at_management_group.py index d233007b2c47..acdadd88059a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/get_policy_set_definition_version_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_definition_versions.py index 7b2ee469a0b9..89b4c5ec8569 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_set_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_set_definition_versions.py index 6241e533a1af..f564ff15ab60 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_set_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_built_in_policy_set_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions.py index 40bc3d465245..de09ec2d8358 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions_by_management_group.py index 4d59f6f2ad8f..4daddd0eca35 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_definition_versions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions.py index b6e040419640..872e036e782d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions_by_management_group.py index 978f2ba7f5f1..d8feb555a399 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_all_policy_set_definition_versions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definition_versions.py index 6f2fde5aa6c2..f574e4d0c46f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definitions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definitions.py index a5b3e1f8d66f..bf1ff62a6a72 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definitions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_definitions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definition_versions.py index 618ce30dc300..7b5288627cff 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definitions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definitions.py index 5513e40fd0ae..6486bbaa4b48 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definitions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_built_in_policy_set_definitions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments.py index 0a3cfa6b1303..f57ab207ebaf 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_management_group.py index fd74dec9be81..df5bdebabd31 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource.py index 4da22566f0e1..2d24a8ca9bd7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource_group.py index 5a026f528f9b..e3be801cf8e6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_assignments_for_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions.py index 7961f0661190..48895f445b39 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions_by_management_group.py index 8588a64383d2..47f7ff929ef6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definition_versions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions.py index b73c741a9bd6..7b6c618f08e2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions_by_management_group.py index 8598386d9540..8b017fddc80a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_definitions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions.py index ead721ce45f1..fd3ec7db9149 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions_by_management_group.py index b861f43a415e..cd7987fbabf3 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definition_versions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions.py index 78a1633e69ce..b28fe0dd35ba 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions_by_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions_by_management_group.py index 76158b589073..a70e6c3fdd9c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions_by_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/list_policy_set_definitions_by_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity.py index 2d469bdd4d6b..0aca6916ead4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity_by_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity_by_id.py index 4e41b491ab35..efd3e38d2852 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity_by_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_identity_by_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_overrides.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_overrides.py index 273407cf8969..d5f66728766e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_overrides.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_overrides.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_resource_selectors.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_resource_selectors.py index 1763f7918d56..cdb94483a72f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_resource_selectors.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_resource_selectors.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_user_assigned_identity.py b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_user_assigned_identity.py index e75870fe874d..4a0ccc1bc51c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_user_assigned_identity.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/policy/update_policy_assignment_with_user_assigned_identity.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy import PolicyClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_private_link_association.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_private_link_association.py index 97d4fe3d0732..b15d60945e5b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_private_link_association.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_private_link_association.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_resource_management_private_link.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_resource_management_private_link.py index 707f4c4c6608..47212d1342ae 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_resource_management_private_link.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/delete_resource_management_private_link.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_private_link_association.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_private_link_association.py index 859cc629b700..2f5abcb8b064 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_private_link_association.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_private_link_association.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_resource_management_private_link.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_resource_management_private_link.py index 78d803371a89..0d659c567195 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_resource_management_private_link.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/get_resource_management_private_link.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_private_link_association.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_private_link_association.py index 439ad9a65898..87fa0340a2be 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_private_link_association.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_private_link_association.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_resource_group_resource_management_private_link.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_resource_group_resource_management_private_link.py index e6532ebefde5..2f07a1d93103 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_resource_group_resource_management_private_link.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_resource_group_resource_management_private_link.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_subscription_resource_management_private_link.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_subscription_resource_management_private_link.py index 5716243de13a..95cceb44d423 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_subscription_resource_management_private_link.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/list_subscription_resource_management_private_link.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_private_link_association.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_private_link_association.py index e167fd5f02d9..71604197be1d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_private_link_association.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_private_link_association.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_resource_management_private_link.py b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_resource_management_private_link.py index 912299e4ec12..9e1e2b027e21 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_resource_management_private_link.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/privatelinks/put_resource_management_private_link.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks import ResourcePrivateLinkClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/calculate_template_hash.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/calculate_template_hash.py index a29a83f52c04..a5e1d4f3a61b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/calculate_template_hash.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/calculate_template_hash.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/create_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/create_resource_group.py index 5c249ac0a00f..69a769620472 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/create_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/create_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_resource.py index 4ab6658ec854..60bbb5ae6fee 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_resource.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_subscription.py index 66660e54182e..c7a93c536028 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/delete_tags_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group.py index 6e0234b757b5..a6e3a531d7c2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_as_bicep.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_as_bicep.py index ce6388f42949..7c0cede6c9e8 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_as_bicep.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_as_bicep.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_with_filtering.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_with_filtering.py index 519b52b4d5be..ae15cc0e7cc8 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_with_filtering.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/export_resource_group_with_filtering.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_and_vmss_in_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_and_vmss_in_resource_group.py index 148c8737c461..654d20501844 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_and_vmss_in_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_and_vmss_in_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_in_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_in_resource_group.py index 923428b8b3a4..a18486b36f58 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_in_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/force_delete_vms_in_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_named_provider_at_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_named_provider_at_tenant.py index 67572c1cb29a..a9f9b84d80cb 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_named_provider_at_tenant.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_named_provider_at_tenant.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider.py index 69c2ce46906b..ea34ff010690 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_permissions.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_permissions.py index b580dde260b7..44514e8d085e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_permissions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_permissions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_resource_types.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_resource_types.py index dea2738e481f..8e88607327a7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_resource_types.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_provider_resource_types.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_providers.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_providers.py index 8ae31bb378b3..508227f8f131 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_providers.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_providers.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_resource.py index 5152a4a40b6e..d1c6a73b097c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_resource.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_subscription.py index b35ac0e664d5..de443b46959c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/get_tags_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_resource.py index ac13b5dbfdb8..fa8bc283e8a4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_resource.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_subscription.py index 26104dc26ed6..b0a9f9dd444b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/patch_tags_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_management_group.py index 81e31ec540e5..85e30d02ebf6 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_resource_group.py index c23854d41d19..be8ca61fd116 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_scope.py index ed30bdee40bb..edadf4a1f426 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_subscription.py index 9320bdbac961..037932e89fec 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_tenant.py index 12ebce1d1588..f5f619d09896 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_tenant.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_validate_on_tenant.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_management_group.py index dc31f08d042a..aa907e8a6c34 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_resource_group.py index 819672c426f5..51cc5495ff80 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_subscription.py index 44c26e3e50ec..613f1d84bb5e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_tenant.py index 48e63093738b..0a3a5e8f46ca 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_tenant.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/post_deployment_what_if_on_tenant.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_management_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_management_group.py index c41a19153c91..52b9d2b4693e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_management_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_management_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_scope.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_scope.py index acaf49f09068..0e7c8307d855 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_scope.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_scope.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_tenant.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_tenant.py index d4f4d369d740..b7eeb6f6a079 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_tenant.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_at_tenant.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group.py index 975f94d29cac..dfa71db09404 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group_template_specs_with_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group_template_specs_with_id.py index 72f15f4f3a58..78c900978429 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group_template_specs_with_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_resource_group_template_specs_with_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_subscription_template_specs_with_id.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_subscription_template_specs_with_id.py index b67957cb044e..20b5e12f62d1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_subscription_template_specs_with_id.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_subscription_template_specs_with_id.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_last_successful.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_last_successful.py index 34165c20f1e0..06e63ade774d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_last_successful.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_last_successful.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_specific_deployment.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_specific_deployment.py index 1d7346086149..8617b5b28aa4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_specific_deployment.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_deployment_with_on_error_deployment_specific_deployment.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_resource.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_resource.py index 3c453e8bcd7d..c551d1a887b3 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_resource.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_resource.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_subscription.py index 2046c3cbce7b..b3320c66b0b7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/resources/put_tags_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources import ResourceManagementClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/check_resource_name.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/check_resource_name.py index dcba6ea31950..88bb098797ff 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/check_resource_name.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/check_resource_name.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations.py index 0418cd3fb232..20489c61d78a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations_with_extended_locations.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations_with_extended_locations.py index 5f94accd8f91..c1289baa5d87 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations_with_extended_locations.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_locations_with_extended_locations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscription.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscription.py index e9d553d598ea..478eff74d346 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscriptions.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscriptions.py index 6804081bc0e0..9d307feaf99d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscriptions.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_subscriptions.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_tenants.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_tenants.py index 43c798c8c22e..76ea272e0bdc 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_tenants.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/get_tenants.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/post_check_zone_peers.py b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/post_check_zone_peers.py index bc81e391ce07..3fb9be0f2970 100644 --- a/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/post_check_zone_peers.py +++ b/sdk/resources/azure-mgmt-resource/generated_samples/subscriptions/post_check_zone_peers.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -8,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions import SubscriptionClient """ # PREREQUISITES diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application.py index 04bd83b9dbf5..3fbbd2d89786 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01 import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations.py index 58e9c549a300..5bff06cf63df 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01 import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations_async.py index ec05d8abcd4a..c4bf17631f1a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_application_definitions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01.aio import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations.py index 89623565331f..be03b319e28a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01 import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations_async.py index 6508fc500142..c95b1b64951e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_applications_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01.aio import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_async.py index 42501d4e29ca..817a0004a7b0 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01.aio import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations.py index d9f3fcf92218..1bc4d90af855 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01 import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations_async.py index f026d2c30f9b..da43f0b14cb1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_application_jit_requests_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ApplicationClient +from azure.mgmt.resource.managedapplications.v2019_07_01.aio import ApplicationClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations.py index 68b8bd178d13..c83a8f2f2365 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ChangesClient +from azure.mgmt.resource.changes.v2022_05_01 import ChangesClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations_async.py index 01ebd0a156f8..6145141e168f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_changes_changes_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ChangesClient +from azure.mgmt.resource.changes.v2022_05_01.aio import ChangesClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations.py index 2bff02598456..0355a4ab2475 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import DataBoundaryMgmtClient +from azure.mgmt.resource.databoundaries.v2024_08_01 import DataBoundaryMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations_async.py index 1d8bd7bd2066..a95d3accef20 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_data_boundary_mgmt_data_boundaries_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import DataBoundaryMgmtClient +from azure.mgmt.resource.databoundaries.v2024_08_01.aio import DataBoundaryMgmtClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations.py index ce0903ccf6bd..63e406dc4b26 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts.v2020_10_01 import DeploymentScriptsClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations_async.py index bd5bf8cc3671..cf633dbf490d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_scripts_deployment_scripts_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import DeploymentScriptsClient +from azure.mgmt.resource.deploymentscripts.v2020_10_01.aio import DeploymentScriptsClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations.py index b16f9c73d480..70faa2d62f6e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks.v2022_08_01_preview import DeploymentStacksClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations_async.py index c659531daa4e..528ee243628c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_deployment_stacks_deployment_stacks_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import DeploymentStacksClient +from azure.mgmt.resource.deploymentstacks.v2022_08_01_preview.aio import DeploymentStacksClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature.py index e74cfa79dfff..9b9f740afa78 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features.v2021_07_01 import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_async.py index 4cc45314dfdc..aedb1ac1ab75 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import FeatureClient +from azure.mgmt.resource.features.v2021_07_01.aio import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations.py index 593fb2cfecce..ef1667fb1ee2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features.v2021_07_01 import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations_async.py index c6d8655c769b..6f491751c94e 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_features_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import FeatureClient +from azure.mgmt.resource.features.v2021_07_01.aio import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations.py index cf24bbe7736c..88a6bb191c9d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import FeatureClient +from azure.mgmt.resource.features.v2021_07_01 import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations_async.py index 643d6de62265..87eaafb125cc 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_feature_subscription_feature_registrations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import FeatureClient +from azure.mgmt.resource.features.v2021_07_01.aio import FeatureClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations.py index 515219c697df..80d54495baa1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ManagementLinkClient +from azure.mgmt.resource.links.v2016_09_01 import ManagementLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations_async.py index 3b7630b39849..5f6e09d96c8b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ManagementLinkClient +from azure.mgmt.resource.links.v2016_09_01.aio import ManagementLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations.py index 4a6266f4c8c5..109aa4daa29d 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ManagementLinkClient +from azure.mgmt.resource.links.v2016_09_01 import ManagementLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations_async.py index e70b34cd517c..43dddd013fd4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_link_resource_links_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ManagementLinkClient +from azure.mgmt.resource.links.v2016_09_01.aio import ManagementLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations.py index 87a1681def0c..9ebc33e4c59a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks.v2016_09_01 import ManagementLockClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations_async.py index 0a88b65b47a6..d7e752c1f3e4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_authorization_operations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ManagementLockClient +from azure.mgmt.resource.locks.v2016_09_01.aio import ManagementLockClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations.py index fb5c3335cd6d..b987930f88ed 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ManagementLockClient +from azure.mgmt.resource.locks.v2016_09_01 import ManagementLockClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations_async.py index 0488d5a8e6e2..c8f244429a80 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_management_lock_management_locks_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ManagementLockClient +from azure.mgmt.resource.locks.v2016_09_01.aio import ManagementLockClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations.py index f70cf20ed221..8964261163a8 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy.v2022_06_01 import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations_async.py index 4d7e10abef85..19e811f30e00 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_assignments_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import PolicyClient +from azure.mgmt.resource.policy.v2022_06_01.aio import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations.py index fd06581987fb..8f86be294d9c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01 import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations_async.py index 6196fb58b2f3..ff189d1075c4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definition_versions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01.aio import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations.py index 568f2310564f..19f3f78988fe 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01 import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations_async.py index 8d1e62af6bb9..5163709c688f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_definitions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01.aio import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations.py index b49a0265910f..a140e191d34c 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01 import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations_async.py index f703d0696f7c..b1747a873099 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definition_versions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01.aio import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations.py index 20fa18a1e79a..a4175450be93 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01 import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations_async.py index 0161723fb65a..5d61874584f2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_policy_policy_set_definitions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import PolicyClient +from azure.mgmt.resource.policy.v2023_04_01.aio import PolicyClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations.py index a797cf5851b1..c0ffcb253d5b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations_async.py index 04d8e87402ee..29902f86d0a0 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployment_operations_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations.py index d40ca22decf4..e7842471096f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations_async.py index 57ce873362da..db0ccbd4d05a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_deployments_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations.py index 9d82c4068506..e3a2fa7cce04 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations_async.py index 6225ff891a3a..a8cdd8dab9fd 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations.py index 50c340eed335..058324e3294b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations_async.py index 46603ab79684..b3d13e16fcc2 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_provider_resource_types_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations.py index 5d6f5504f429..d2025c1f1b4f 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations_async.py index f893acca8f97..e4ccf860dfad 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_providers_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations.py index b0687bad739a..b91d7bab797a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations_async.py index ce6a18bdf50b..cc76463b0198 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resource_groups_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations.py index 828c05884e99..38b36e0b4fc4 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations_async.py index ec04070c5bd9..d36e574cfe2b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_resources_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations.py index 39011a1569de..720f4d4b884a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01 import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations_async.py index 1ce770cafd26..100b871238fa 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_management_tags_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourceManagementClient +from azure.mgmt.resource.resources.v2022_09_01.aio import ResourceManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations.py index 8c6b465b5c7c..08ab5955fec1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks.v2020_05_01 import ResourcePrivateLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations_async.py index 184961f78520..313694a86f00 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_private_link_association_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks.v2020_05_01.aio import ResourcePrivateLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations.py index b5bfadc9affb..9ef0b6bd100a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks.v2020_05_01 import ResourcePrivateLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations_async.py index a4e6f421a0fc..a3b042c07cd1 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_resource_private_link_resource_management_private_link_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import ResourcePrivateLinkClient +from azure.mgmt.resource.privatelinks.v2020_05_01.aio import ResourcePrivateLinkClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription.py index 92f92648219b..849ba8deab0b 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01 import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_async.py index 7bf535202bbb..f1579fe00646 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01.aio import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations.py index 906c6ab8564a..cafbb7328572 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01 import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations_async.py index 9f696b3b753b..0e56200f1df7 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01.aio import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations.py index a730c440e8c4..00a1f6f8402a 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01 import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations_async.py index d9a24a1c5f39..3a87c95759fb 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_subscriptions_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01.aio import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations.py index 076204ce2bcb..90cbdc080efb 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01 import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy diff --git a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations_async.py b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations_async.py index fef886206c24..be0e163f54fe 100644 --- a/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations_async.py +++ b/sdk/resources/azure-mgmt-resource/generated_tests/test_subscription_tenants_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.resource.aio import SubscriptionClient +from azure.mgmt.resource.subscriptions.v2022_12_01.aio import SubscriptionClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async diff --git a/sdk/resources/azure-mgmt-resource/setup.py b/sdk/resources/azure-mgmt-resource/setup.py index f05ccb17cefb..0ddb0e92da42 100644 --- a/sdk/resources/azure-mgmt-resource/setup.py +++ b/sdk/resources/azure-mgmt-resource/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )