From 07b1cffbbc05a5c062e8004fa10afd953c10719a Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Tue, 9 Aug 2022 20:31:01 -0700 Subject: [PATCH] [AutoRelease] t2-keyvault-2022-08-09-16824(Do not merge) (#25615) * code and test * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md Co-authored-by: PythonSdkPipelines Co-authored-by: Yuchao Yan --- sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md | 14 +- sdk/keyvault/azure-mgmt-keyvault/README.md | 1 - sdk/keyvault/azure-mgmt-keyvault/_meta.json | 6 +- .../keyvault/_key_vault_management_client.py | 33 +- .../azure/mgmt/keyvault/_version.py | 2 +- .../aio/_key_vault_management_client.py | 33 +- .../azure/mgmt/keyvault/models.py | 2 +- .../mgmt/keyvault/v2016_10_01/__init__.py | 13 +- .../_key_vault_management_client.py | 8 +- .../mgmt/keyvault/v2016_10_01/_version.py | 2 +- .../mgmt/keyvault/v2016_10_01/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 8 +- .../v2016_10_01/aio/operations/__init__.py | 5 + .../v2016_10_01/aio/operations/_operations.py | 48 +- .../v2016_10_01/aio/operations/_patch.py | 19 + .../aio/operations/_vaults_operations.py | 278 +- .../keyvault/v2016_10_01/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 19 +- .../v2016_10_01/models/_models_py3.py | 77 +- .../keyvault/v2016_10_01/models/_patch.py | 19 + .../v2016_10_01/operations/__init__.py | 5 + .../v2016_10_01/operations/_operations.py | 67 +- .../keyvault/v2016_10_01/operations/_patch.py | 19 + .../operations/_vaults_operations.py | 501 ++- .../mgmt/keyvault/v2018_02_14/__init__.py | 13 +- .../_key_vault_management_client.py | 16 +- .../mgmt/keyvault/v2018_02_14/_version.py | 2 +- .../mgmt/keyvault/v2018_02_14/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 16 +- .../v2018_02_14/aio/operations/__init__.py | 5 + .../v2018_02_14/aio/operations/_operations.py | 48 +- .../v2018_02_14/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 110 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_vaults_operations.py | 306 +- .../keyvault/v2018_02_14/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 27 +- .../v2018_02_14/models/_models_py3.py | 125 +- .../keyvault/v2018_02_14/models/_patch.py | 19 + .../v2018_02_14/operations/__init__.py | 5 + .../v2018_02_14/operations/_operations.py | 67 +- .../keyvault/v2018_02_14/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 170 +- .../_private_link_resources_operations.py | 65 +- .../operations/_vaults_operations.py | 529 ++- .../mgmt/keyvault/v2019_09_01/__init__.py | 13 +- .../_key_vault_management_client.py | 20 +- .../mgmt/keyvault/v2019_09_01/_version.py | 2 +- .../mgmt/keyvault/v2019_09_01/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 20 +- .../v2019_09_01/aio/operations/__init__.py | 5 + .../aio/operations/_keys_operations.py | 122 +- .../v2019_09_01/aio/operations/_operations.py | 48 +- .../v2019_09_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 110 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_vaults_operations.py | 306 +- .../keyvault/v2019_09_01/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 37 +- .../v2019_09_01/models/_models_py3.py | 199 +- .../keyvault/v2019_09_01/models/_patch.py | 19 + .../v2019_09_01/operations/__init__.py | 5 + .../operations/_keys_operations.py | 216 +- .../v2019_09_01/operations/_operations.py | 67 +- .../keyvault/v2019_09_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 170 +- .../_private_link_resources_operations.py | 65 +- .../operations/_vaults_operations.py | 547 ++- .../keyvault/v2020_04_01_preview/__init__.py | 13 +- .../_key_vault_management_client.py | 28 +- .../keyvault/v2020_04_01_preview/_version.py | 2 +- .../v2020_04_01_preview/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 28 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_keys_operations.py | 122 +- .../operations/_managed_hsms_operations.py | 220 +- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 110 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_secrets_operations.py | 107 +- .../aio/operations/_vaults_operations.py | 306 +- .../v2020_04_01_preview/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 47 +- .../v2020_04_01_preview/models/_models_py3.py | 262 +- .../v2020_04_01_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_keys_operations.py | 216 +- .../operations/_managed_hsms_operations.py | 341 +- .../operations/_operations.py | 67 +- .../v2020_04_01_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 170 +- .../_private_link_resources_operations.py | 65 +- .../operations/_secrets_operations.py | 192 +- .../operations/_vaults_operations.py | 547 ++- .../keyvault/v2021_04_01_preview/__init__.py | 13 +- .../_key_vault_management_client.py | 28 +- .../keyvault/v2021_04_01_preview/_version.py | 2 +- .../v2021_04_01_preview/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 28 +- .../aio/operations/__init__.py | 5 + .../operations/_managed_hsms_operations.py | 297 +- ...private_endpoint_connections_operations.py | 129 +- ..._mhsm_private_link_resources_operations.py | 46 +- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 129 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_vaults_operations.py | 306 +- .../v2021_04_01_preview/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 41 +- .../v2021_04_01_preview/models/_models_py3.py | 300 +- .../v2021_04_01_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_managed_hsms_operations.py | 469 +- ...private_endpoint_connections_operations.py | 206 +- ..._mhsm_private_link_resources_operations.py | 65 +- .../operations/_operations.py | 67 +- .../v2021_04_01_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 206 +- .../_private_link_resources_operations.py | 65 +- .../operations/_vaults_operations.py | 547 ++- .../keyvault/v2021_06_01_preview/__init__.py | 13 +- .../_key_vault_management_client.py | 36 +- .../keyvault/v2021_06_01_preview/_version.py | 2 +- .../v2021_06_01_preview/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 36 +- .../aio/operations/__init__.py | 5 + .../aio/operations/_keys_operations.py | 122 +- .../operations/_managed_hsms_operations.py | 297 +- ...private_endpoint_connections_operations.py | 129 +- ..._mhsm_private_link_resources_operations.py | 46 +- .../aio/operations/_operations.py | 48 +- .../aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 129 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_secrets_operations.py | 107 +- .../aio/operations/_vaults_operations.py | 306 +- .../v2021_06_01_preview/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 51 +- .../v2021_06_01_preview/models/_models_py3.py | 390 +- .../v2021_06_01_preview/models/_patch.py | 19 + .../operations/__init__.py | 5 + .../operations/_keys_operations.py | 216 +- .../operations/_managed_hsms_operations.py | 469 +- ...private_endpoint_connections_operations.py | 206 +- ..._mhsm_private_link_resources_operations.py | 65 +- .../operations/_operations.py | 67 +- .../v2021_06_01_preview/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 206 +- .../_private_link_resources_operations.py | 65 +- .../operations/_secrets_operations.py | 192 +- .../operations/_vaults_operations.py | 547 ++- .../mgmt/keyvault/v2021_10_01/__init__.py | 13 +- .../_key_vault_management_client.py | 36 +- .../mgmt/keyvault/v2021_10_01/_version.py | 2 +- .../mgmt/keyvault/v2021_10_01/aio/__init__.py | 13 +- .../aio/_key_vault_management_client.py | 36 +- .../v2021_10_01/aio/operations/__init__.py | 5 + .../aio/operations/_keys_operations.py | 122 +- .../operations/_managed_hsms_operations.py | 297 +- ...private_endpoint_connections_operations.py | 129 +- ..._mhsm_private_link_resources_operations.py | 46 +- .../v2021_10_01/aio/operations/_operations.py | 48 +- .../v2021_10_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 129 +- .../_private_link_resources_operations.py | 46 +- .../aio/operations/_secrets_operations.py | 107 +- .../aio/operations/_vaults_operations.py | 306 +- .../keyvault/v2021_10_01/models/__init__.py | 6 +- .../_key_vault_management_client_enums.py | 49 +- .../v2021_10_01/models/_models_py3.py | 368 +- .../keyvault/v2021_10_01/models/_patch.py | 19 + .../v2021_10_01/operations/__init__.py | 5 + .../operations/_keys_operations.py | 216 +- .../operations/_managed_hsms_operations.py | 469 +- ...private_endpoint_connections_operations.py | 206 +- ..._mhsm_private_link_resources_operations.py | 65 +- .../v2021_10_01/operations/_operations.py | 67 +- .../keyvault/v2021_10_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 206 +- .../_private_link_resources_operations.py | 65 +- .../operations/_secrets_operations.py | 192 +- .../operations/_vaults_operations.py | 547 ++- .../mgmt/keyvault/v2022_07_01/__init__.py | 23 + .../keyvault/v2022_07_01/_configuration.py | 74 + .../_key_vault_management_client.py | 145 + .../mgmt/keyvault/v2022_07_01/_metadata.json | 110 + .../azure/mgmt/keyvault/v2022_07_01/_patch.py | 19 + .../mgmt/keyvault/v2022_07_01/_vendor.py | 27 + .../mgmt/keyvault/v2022_07_01/_version.py | 9 + .../mgmt/keyvault/v2022_07_01/aio/__init__.py | 20 + .../v2022_07_01/aio/_configuration.py | 73 + .../aio/_key_vault_management_client.py | 142 + .../mgmt/keyvault/v2022_07_01/aio/_patch.py | 19 + .../v2022_07_01/aio/operations/__init__.py | 34 + .../aio/operations/_keys_operations.py | 447 ++ .../operations/_managed_hsms_operations.py | 1039 +++++ ...private_endpoint_connections_operations.py | 429 ++ ..._mhsm_private_link_resources_operations.py | 106 + .../v2022_07_01/aio/operations/_operations.py | 121 + .../v2022_07_01/aio/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 430 ++ .../_private_link_resources_operations.py | 106 + .../aio/operations/_secrets_operations.py | 369 ++ .../aio/operations/_vaults_operations.py | 1055 +++++ .../keyvault/v2022_07_01/models/__init__.py | 229 + .../_key_vault_management_client_enums.py | 282 ++ .../v2022_07_01/models/_models_py3.py | 3965 +++++++++++++++++ .../keyvault/v2022_07_01/models/_patch.py | 19 + .../v2022_07_01/operations/__init__.py | 34 + .../operations/_keys_operations.py | 650 +++ .../operations/_managed_hsms_operations.py | 1427 ++++++ ...private_endpoint_connections_operations.py | 593 +++ ..._mhsm_private_link_resources_operations.py | 146 + .../v2022_07_01/operations/_operations.py | 151 + .../keyvault/v2022_07_01/operations/_patch.py | 19 + ...private_endpoint_connections_operations.py | 594 +++ .../_private_link_resources_operations.py | 146 + .../operations/_secrets_operations.py | 544 +++ .../operations/_vaults_operations.py | 1529 +++++++ .../azure/mgmt/keyvault/v2022_07_01/py.typed | 1 + ...vault.pyTestMgmtKeyVaulttest_keyvault.json | 390 +- shared_requirements.txt | 2 +- 224 files changed, 26652 insertions(+), 7660 deletions(-) create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_configuration.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_key_vault_management_client.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_metadata.json create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_vendor.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_configuration.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_key_vault_management_client.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_keys_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_link_resources_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_key_vault_management_client_enums.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_models_py3.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/__init__.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_keys_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_link_resources_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_link_resources_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py create mode 100644 sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/py.typed diff --git a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md index 7d93252c7581..09eb0b6bfccd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md +++ b/sdk/keyvault/azure-mgmt-keyvault/CHANGELOG.md @@ -1,6 +1,18 @@ # Release History -## 10.0.1b1 (Unreleased) +## 10.1.0 (2022-08-10) + +### Features Added + + - Added operation ManagedHsmsOperations.check_mhsm_name_availability + - Model Key has a new parameter release_policy + - Model Key has a new parameter rotation_policy + - Model KeyProperties has a new parameter release_policy + - Model KeyProperties has a new parameter rotation_policy + - Model MHSMPrivateEndpointConnectionItem has a new parameter etag + - Model MHSMPrivateEndpointConnectionItem has a new parameter id + +### Other Changes - Python 3.6 is no longer supported. Please use Python version 3.7 or later. diff --git a/sdk/keyvault/azure-mgmt-keyvault/README.md b/sdk/keyvault/azure-mgmt-keyvault/README.md index baa7406c0d84..eab86de24ff9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/README.md +++ b/sdk/keyvault/azure-mgmt-keyvault/README.md @@ -7,7 +7,6 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( ## _Disclaimer_ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -_Python 3.7 or later is required to use this package. For more details, please refer to [Azure SDK for Python version support policy](https://github.com/Azure/azure-sdk-for-python/wiki/Azure-SDKs-Python-version-support-policy)._ # Usage diff --git a/sdk/keyvault/azure-mgmt-keyvault/_meta.json b/sdk/keyvault/azure-mgmt-keyvault/_meta.json index 6cbc99bb86c0..599930fa425d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/_meta.json +++ b/sdk/keyvault/azure-mgmt-keyvault/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.13.0", + "@autorest/python@5.16.0", "@autorest/modelerfour@4.19.3" ], - "commit": "61001b68a8aa743f0dd890224c6b5cb130ef006e", + "commit": "1b3b9c1dd4d2c875997ea0b392dc71418fb1f28d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/keyvault/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/keyvault/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py index a064e52a27f2..aba855e16cb1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_key_vault_management_client.py @@ -56,7 +56,7 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-10-01' + DEFAULT_API_VERSION = '2022-07-01' _PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -96,6 +96,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-04-01-preview: :mod:`v2021_04_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-10-01: :mod:`v2021_10_01.models` + * 2022-07-01: :mod:`v2022_07_01.models` """ if api_version == '2016-10-01': from .v2016_10_01 import models @@ -118,6 +119,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-10-01': from .v2021_10_01 import models return models + elif api_version == '2022-07-01': + from .v2022_07_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -128,6 +132,7 @@ def keys(self): * 2020-04-01-preview: :class:`KeysOperations` * 2021-06-01-preview: :class:`KeysOperations` * 2021-10-01: :class:`KeysOperations` + * 2022-07-01: :class:`KeysOperations` """ api_version = self._get_api_version('keys') if api_version == '2019-09-01': @@ -138,6 +143,8 @@ def keys(self): from .v2021_06_01_preview.operations import KeysOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import KeysOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import KeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -150,6 +157,7 @@ def managed_hsms(self): * 2021-04-01-preview: :class:`ManagedHsmsOperations` * 2021-06-01-preview: :class:`ManagedHsmsOperations` * 2021-10-01: :class:`ManagedHsmsOperations` + * 2022-07-01: :class:`ManagedHsmsOperations` """ api_version = self._get_api_version('managed_hsms') if api_version == '2020-04-01-preview': @@ -160,6 +168,8 @@ def managed_hsms(self): from .v2021_06_01_preview.operations import ManagedHsmsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import ManagedHsmsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import ManagedHsmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -171,6 +181,7 @@ def mhsm_private_endpoint_connections(self): * 2021-04-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` * 2021-10-01: :class:`MHSMPrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`MHSMPrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('mhsm_private_endpoint_connections') if api_version == '2021-04-01-preview': @@ -179,6 +190,8 @@ def mhsm_private_endpoint_connections(self): from .v2021_06_01_preview.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -190,6 +203,7 @@ def mhsm_private_link_resources(self): * 2021-04-01-preview: :class:`MHSMPrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`MHSMPrivateLinkResourcesOperations` * 2021-10-01: :class:`MHSMPrivateLinkResourcesOperations` + * 2022-07-01: :class:`MHSMPrivateLinkResourcesOperations` """ api_version = self._get_api_version('mhsm_private_link_resources') if api_version == '2021-04-01-preview': @@ -198,6 +212,8 @@ def mhsm_private_link_resources(self): from .v2021_06_01_preview.operations import MHSMPrivateLinkResourcesOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import MHSMPrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import MHSMPrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -213,6 +229,7 @@ def operations(self): * 2021-04-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-10-01: :class:`Operations` + * 2022-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -229,6 +246,8 @@ def operations(self): from .v2021_06_01_preview.operations import Operations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import Operations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -243,6 +262,7 @@ def private_endpoint_connections(self): * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -257,6 +277,8 @@ def private_endpoint_connections(self): from .v2021_06_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -271,6 +293,7 @@ def private_link_resources(self): * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-10-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -285,6 +308,8 @@ def private_link_resources(self): from .v2021_06_01_preview.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -296,6 +321,7 @@ def secrets(self): * 2020-04-01-preview: :class:`SecretsOperations` * 2021-06-01-preview: :class:`SecretsOperations` * 2021-10-01: :class:`SecretsOperations` + * 2022-07-01: :class:`SecretsOperations` """ api_version = self._get_api_version('secrets') if api_version == '2020-04-01-preview': @@ -304,6 +330,8 @@ def secrets(self): from .v2021_06_01_preview.operations import SecretsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import SecretsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import SecretsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secrets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -319,6 +347,7 @@ def vaults(self): * 2021-04-01-preview: :class:`VaultsOperations` * 2021-06-01-preview: :class:`VaultsOperations` * 2021-10-01: :class:`VaultsOperations` + * 2022-07-01: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -335,6 +364,8 @@ def vaults(self): from .v2021_06_01_preview.operations import VaultsOperations as OperationClass elif api_version == '2021-10-01': from .v2021_10_01.operations import VaultsOperations as OperationClass + elif api_version == '2022-07-01': + from .v2022_07_01.operations import VaultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'vaults'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py index 4e01c2542d6a..f8ce5fbf06ff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/_version.py @@ -5,4 +5,4 @@ # license information. # -------------------------------------------------------------------------- -VERSION = "10.0.1b1" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py index d00a61633059..6ede600b362e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/aio/_key_vault_management_client.py @@ -55,7 +55,7 @@ class KeyVaultManagementClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2021-10-01' + DEFAULT_API_VERSION = '2022-07-01' _PROFILE_TAG = "azure.mgmt.keyvault.KeyVaultManagementClient" LATEST_PROFILE = ProfileDefinition({ _PROFILE_TAG: { @@ -95,6 +95,7 @@ def models(cls, api_version=DEFAULT_API_VERSION): * 2021-04-01-preview: :mod:`v2021_04_01_preview.models` * 2021-06-01-preview: :mod:`v2021_06_01_preview.models` * 2021-10-01: :mod:`v2021_10_01.models` + * 2022-07-01: :mod:`v2022_07_01.models` """ if api_version == '2016-10-01': from ..v2016_10_01 import models @@ -117,6 +118,9 @@ def models(cls, api_version=DEFAULT_API_VERSION): elif api_version == '2021-10-01': from ..v2021_10_01 import models return models + elif api_version == '2022-07-01': + from ..v2022_07_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @property @@ -127,6 +131,7 @@ def keys(self): * 2020-04-01-preview: :class:`KeysOperations` * 2021-06-01-preview: :class:`KeysOperations` * 2021-10-01: :class:`KeysOperations` + * 2022-07-01: :class:`KeysOperations` """ api_version = self._get_api_version('keys') if api_version == '2019-09-01': @@ -137,6 +142,8 @@ def keys(self): from ..v2021_06_01_preview.aio.operations import KeysOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import KeysOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import KeysOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'keys'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -149,6 +156,7 @@ def managed_hsms(self): * 2021-04-01-preview: :class:`ManagedHsmsOperations` * 2021-06-01-preview: :class:`ManagedHsmsOperations` * 2021-10-01: :class:`ManagedHsmsOperations` + * 2022-07-01: :class:`ManagedHsmsOperations` """ api_version = self._get_api_version('managed_hsms') if api_version == '2020-04-01-preview': @@ -159,6 +167,8 @@ def managed_hsms(self): from ..v2021_06_01_preview.aio.operations import ManagedHsmsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import ManagedHsmsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import ManagedHsmsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_hsms'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -170,6 +180,7 @@ def mhsm_private_endpoint_connections(self): * 2021-04-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`MHSMPrivateEndpointConnectionsOperations` * 2021-10-01: :class:`MHSMPrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`MHSMPrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('mhsm_private_endpoint_connections') if api_version == '2021-04-01-preview': @@ -178,6 +189,8 @@ def mhsm_private_endpoint_connections(self): from ..v2021_06_01_preview.aio.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import MHSMPrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -189,6 +202,7 @@ def mhsm_private_link_resources(self): * 2021-04-01-preview: :class:`MHSMPrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`MHSMPrivateLinkResourcesOperations` * 2021-10-01: :class:`MHSMPrivateLinkResourcesOperations` + * 2022-07-01: :class:`MHSMPrivateLinkResourcesOperations` """ api_version = self._get_api_version('mhsm_private_link_resources') if api_version == '2021-04-01-preview': @@ -197,6 +211,8 @@ def mhsm_private_link_resources(self): from ..v2021_06_01_preview.aio.operations import MHSMPrivateLinkResourcesOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import MHSMPrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import MHSMPrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'mhsm_private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -212,6 +228,7 @@ def operations(self): * 2021-04-01-preview: :class:`Operations` * 2021-06-01-preview: :class:`Operations` * 2021-10-01: :class:`Operations` + * 2022-07-01: :class:`Operations` """ api_version = self._get_api_version('operations') if api_version == '2016-10-01': @@ -228,6 +245,8 @@ def operations(self): from ..v2021_06_01_preview.aio.operations import Operations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import Operations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -242,6 +261,7 @@ def private_endpoint_connections(self): * 2021-04-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-06-01-preview: :class:`PrivateEndpointConnectionsOperations` * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` """ api_version = self._get_api_version('private_endpoint_connections') if api_version == '2018-02-14': @@ -256,6 +276,8 @@ def private_endpoint_connections(self): from ..v2021_06_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -270,6 +292,7 @@ def private_link_resources(self): * 2021-04-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-06-01-preview: :class:`PrivateLinkResourcesOperations` * 2021-10-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` """ api_version = self._get_api_version('private_link_resources') if api_version == '2018-02-14': @@ -284,6 +307,8 @@ def private_link_resources(self): from ..v2021_06_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import PrivateLinkResourcesOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -295,6 +320,7 @@ def secrets(self): * 2020-04-01-preview: :class:`SecretsOperations` * 2021-06-01-preview: :class:`SecretsOperations` * 2021-10-01: :class:`SecretsOperations` + * 2022-07-01: :class:`SecretsOperations` """ api_version = self._get_api_version('secrets') if api_version == '2020-04-01-preview': @@ -303,6 +329,8 @@ def secrets(self): from ..v2021_06_01_preview.aio.operations import SecretsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import SecretsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import SecretsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'secrets'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) @@ -318,6 +346,7 @@ def vaults(self): * 2021-04-01-preview: :class:`VaultsOperations` * 2021-06-01-preview: :class:`VaultsOperations` * 2021-10-01: :class:`VaultsOperations` + * 2022-07-01: :class:`VaultsOperations` """ api_version = self._get_api_version('vaults') if api_version == '2016-10-01': @@ -334,6 +363,8 @@ def vaults(self): from ..v2021_06_01_preview.aio.operations import VaultsOperations as OperationClass elif api_version == '2021-10-01': from ..v2021_10_01.aio.operations import VaultsOperations as OperationClass + elif api_version == '2022-07-01': + from ..v2022_07_01.aio.operations import VaultsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'vaults'".format(api_version)) return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models.py index a5519c17e517..9ceff3832d24 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/models.py @@ -4,4 +4,4 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- -from .v2021_10_01.models import * +from .v2022_07_01.models import * diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py index 7174fd4ede8e..be3c9e90bbdb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_key_vault_management_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py index 14de78083748..1d5472e4496e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/_key_vault_management_client.py @@ -58,8 +58,12 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/__init__.py index 3d2bb8ce16b1..28a2756c332a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/__init__.py @@ -9,7 +9,12 @@ from ._vaults_operations import VaultsOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py index b5a6423a5802..d5fb0c872d89 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2016_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2016_10_01.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py index 6b6360024622..43e9b6d9a3cb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,35 +27,33 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2016_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2016_10_01.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -68,14 +67,17 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -87,11 +89,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -121,9 +125,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -137,14 +141,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -156,11 +163,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -203,13 +212,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -218,11 +230,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -245,7 +259,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -257,13 +271,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -272,11 +289,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -303,9 +322,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -321,14 +340,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -341,11 +363,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -376,7 +400,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -390,13 +414,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -406,9 +433,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -418,9 +447,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -458,7 +489,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -469,13 +500,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -484,9 +518,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -495,9 +531,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -534,7 +572,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -544,13 +582,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -558,9 +599,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -568,9 +611,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -609,7 +654,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -621,13 +666,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -636,11 +684,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -667,13 +717,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -682,11 +735,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -728,20 +783,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -751,8 +811,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -770,7 +836,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -788,14 +854,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -805,9 +874,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -817,9 +888,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -855,9 +928,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -867,14 +940,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -884,11 +960,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py index 98725b3d9d2e..1a7469649056 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/__init__.py @@ -42,7 +42,9 @@ SkuName, StoragePermissions, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', @@ -77,3 +79,5 @@ 'SkuName', 'StoragePermissions', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py index da8191d9cf5b..cadf1ab4c587 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_key_vault_management_client_enums.py @@ -7,17 +7,16 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -34,14 +33,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) RECOVER = "recover" PURGE = "purge" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -60,7 +59,7 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -68,7 +67,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -79,20 +78,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py index 33dd798afabc..24adadc6a20c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -49,7 +51,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -84,8 +86,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2016_10_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -146,7 +147,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -177,7 +178,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -302,9 +303,9 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -387,7 +388,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -426,10 +427,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -523,7 +524,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -552,7 +553,7 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, **kwargs ): """ @@ -568,10 +569,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ @@ -588,15 +589,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2016_10_01.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -646,7 +647,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -701,7 +702,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -737,7 +738,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -817,7 +818,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -853,7 +854,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -886,7 +887,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -924,7 +925,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. The property may not be set to false. :vartype enable_soft_delete: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault; it is only effective if soft delete is also enabled. Once activated, the @@ -948,13 +949,13 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, **kwargs ): @@ -980,7 +981,7 @@ def __init__( is enabled for this key vault. The property may not be set to false. :paramtype enable_soft_delete: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault; it is only effective if soft delete is also enabled. Once activated, @@ -1031,7 +1032,7 @@ class VaultProperties(msrest.serialization.Model): that is, the property does not accept false as its value. :vartype enable_soft_delete: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1063,14 +1064,14 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, **kwargs ): @@ -1102,7 +1103,7 @@ def __init__( - that is, the property does not accept false as its value. :paramtype enable_soft_delete: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2016_10_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py index 3d2bb8ce16b1..28a2756c332a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/__init__.py @@ -9,7 +9,12 @@ from ._vaults_operations import VaultsOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py index 06a987edac05..0d358b03182a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2016_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2016_10_01.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py index e679614fe9be..9ef0a56749a9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,8 +125,9 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -136,13 +139,12 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -153,9 +155,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -167,18 +172,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -189,14 +192,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +215,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -236,9 +240,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -249,20 +256,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -273,9 +278,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -285,20 +293,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -307,9 +313,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -319,18 +328,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -341,9 +348,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -355,18 +365,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -377,8 +385,9 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -390,13 +399,12 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -407,10 +415,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -420,21 +431,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +451,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -459,55 +471,51 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2016_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2016_10_01.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -521,14 +529,17 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -540,11 +551,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -574,9 +587,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -590,14 +603,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -609,11 +625,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -656,13 +674,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -671,11 +692,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -698,7 +721,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -710,13 +733,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -725,11 +751,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -756,9 +784,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -774,14 +802,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -794,11 +825,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -829,7 +862,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -842,13 +875,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -858,9 +894,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -870,9 +908,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -910,7 +950,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -920,13 +960,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -935,9 +978,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -946,9 +991,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -985,7 +1032,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -995,13 +1042,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1009,9 +1059,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1019,9 +1071,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1060,7 +1114,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1072,13 +1126,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1087,11 +1144,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1118,13 +1177,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2016-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1133,11 +1195,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1179,20 +1243,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2016-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1202,8 +1271,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1221,7 +1296,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1239,14 +1314,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2016_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1256,9 +1334,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1268,9 +1348,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1306,9 +1388,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1318,14 +1400,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2016_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2016-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2016-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1335,11 +1420,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py index 40a164e19f3d..b8b552cac871 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_key_vault_management_client.py @@ -64,10 +64,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py index 54b5e6d29759..899c1f139fce 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/_key_vault_management_client.py @@ -64,10 +64,18 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/__init__.py index ad4413dd4cae..0bc5219d4dff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py index 43e1bcd6123c..a66ef1ec9567 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py index 914aff23dfed..7c8e80983fb7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -52,7 +51,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,13 +66,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -83,11 +85,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -114,9 +118,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -133,14 +137,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -153,11 +160,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -188,14 +197,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -205,11 +217,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -245,7 +259,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -269,35 +283,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py index 7f8f8c7a5f58..a87b2d1c9374 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py index 89b8d6835a33..faa6cb65a793 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -130,37 +134,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -178,9 +192,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -194,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -213,11 +230,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -260,13 +279,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,11 +297,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -302,7 +326,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,13 +338,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -329,11 +356,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -360,9 +389,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -378,14 +407,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -398,11 +430,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -433,7 +467,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -447,13 +481,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -463,9 +500,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -475,9 +514,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -515,7 +556,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -526,13 +567,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +585,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -552,9 +598,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +639,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -601,13 +649,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -615,9 +666,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -625,9 +678,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -666,7 +721,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -678,13 +733,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -693,11 +751,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -724,13 +784,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -739,11 +802,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,20 +850,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -808,8 +878,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -827,7 +903,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -845,14 +921,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -862,9 +941,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -874,9 +955,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -912,9 +995,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -924,14 +1007,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -941,11 +1027,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py index aaeaaee4e5e8..127f5bac6896 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/__init__.py @@ -56,7 +56,9 @@ SkuName, StoragePermissions, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', @@ -105,3 +107,5 @@ 'SkuName', 'StoragePermissions', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py index 0859f28f2360..c32d9677a80b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_key_vault_management_client_enums.py @@ -7,17 +7,16 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -36,14 +35,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -62,7 +61,7 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -70,7 +69,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -78,7 +77,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -89,7 +88,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -98,7 +97,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -106,7 +105,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -117,20 +116,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py index 0907e3610f53..fd20a411d5ac 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -49,7 +51,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -84,8 +86,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2018_02_14.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -180,7 +181,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -211,7 +212,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -349,11 +350,11 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :ivar ip_rules: The list of IP address rules. @@ -373,20 +374,20 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2018_02_14.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. :paramtype ip_rules: list[~azure.mgmt.keyvault.v2018_02_14.models.IPRule] @@ -425,9 +426,9 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -510,7 +511,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -549,10 +550,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -667,8 +668,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -696,8 +697,8 @@ class PrivateEndpointConnection(Resource): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -723,8 +724,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnectionProvisioningState """ @@ -742,8 +743,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -833,7 +834,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -848,7 +849,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. @@ -867,14 +868,14 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, action_required: Optional[str] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. @@ -906,7 +907,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -935,7 +936,7 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, **kwargs ): """ @@ -951,10 +952,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ @@ -971,15 +972,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2018_02_14.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -1027,7 +1028,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -1087,7 +1088,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -1123,7 +1124,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -1203,7 +1204,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1239,7 +1240,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1272,7 +1273,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -1310,7 +1311,7 @@ class VaultPatchProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :vartype enable_soft_delete: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1340,15 +1341,15 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, **kwargs ): """ @@ -1373,7 +1374,7 @@ def __init__( enabled for this key vault. It does not accept false value. :paramtype enable_soft_delete: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -1430,7 +1431,7 @@ class VaultProperties(msrest.serialization.Model): enabled for this key vault. It does not accept false value. :vartype enable_soft_delete: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1472,16 +1473,16 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, **kwargs ): """ @@ -1510,7 +1511,7 @@ def __init__( enabled for this key vault. It does not accept false value. :paramtype enable_soft_delete: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2018_02_14.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py index ad4413dd4cae..0bc5219d4dff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/__init__.py @@ -11,9 +11,14 @@ from ._private_link_resources_operations import PrivateLinkResourcesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py index 95974f52e185..dc9f920f0a55 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py index b9b38f74eaa9..2ab2ae1e3a7e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -50,18 +53,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,14 +73,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -92,20 +96,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,9 +121,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -134,42 +139,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -178,7 +179,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -193,13 +194,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] request = build_get_request( @@ -209,11 +213,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -240,9 +246,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -259,14 +265,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -279,11 +288,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -314,14 +325,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -331,11 +345,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -371,7 +387,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -395,35 +411,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py index ed90681dc8ba..4f1badb0f66d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py index 240293d7c18f..3104ef892780 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,8 +125,9 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -136,13 +139,12 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -153,9 +155,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -167,18 +172,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -189,14 +192,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +215,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -236,9 +240,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -249,20 +256,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -273,9 +278,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -285,20 +293,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -307,9 +313,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -319,18 +328,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -341,9 +348,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -355,18 +365,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -377,8 +385,9 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -390,13 +399,12 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, + params=_params, **kwargs ) @@ -407,10 +415,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -420,21 +431,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -442,14 +451,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -459,62 +471,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2018_02_14.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2018_02_14.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -526,11 +537,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -560,9 +573,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -583,37 +596,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2018_02_14.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -631,9 +654,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -647,14 +670,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -666,11 +692,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -713,13 +741,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -728,11 +759,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -755,7 +788,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -767,13 +800,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -782,11 +818,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -813,9 +851,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -831,14 +869,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -851,11 +892,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -886,7 +929,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -899,13 +942,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -915,9 +961,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -927,9 +975,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -967,7 +1017,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -977,13 +1027,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -992,9 +1045,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1003,9 +1058,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1042,7 +1099,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1052,13 +1109,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1066,9 +1126,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1076,9 +1138,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1117,7 +1181,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1129,13 +1193,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1144,11 +1211,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1175,13 +1244,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2018-02-14") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1190,11 +1262,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1236,20 +1310,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2018-02-14") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1259,8 +1338,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1278,7 +1363,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1296,14 +1381,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2018_02_14.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1313,9 +1401,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1325,9 +1415,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1363,9 +1455,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1375,14 +1467,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2018_02_14.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2018-02-14") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-02-14")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1392,11 +1487,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py index 4e0dafdb0bc3..3e44eab5ea4f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_key_vault_management_client.py @@ -66,11 +66,21 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py index 17fcd1c492f3..c2e0bb9b3fd4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/_key_vault_management_client.py @@ -66,11 +66,21 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py index 7b62b7166158..a30353f460a6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/__init__.py @@ -12,6 +12,9 @@ from ._operations import Operations from ._keys_operations import KeysOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', @@ -19,3 +22,5 @@ 'Operations', 'KeysOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py index d6493f6c5d9e..215f043b2e94 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_keys_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeysOperations: - """KeysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_if_not_exist( @@ -51,9 +50,9 @@ async def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -72,14 +71,17 @@ async def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -92,11 +94,13 @@ async def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -124,7 +128,7 @@ async def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -139,13 +143,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -155,11 +162,13 @@ async def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -186,7 +195,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -200,13 +209,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -216,9 +228,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +242,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -271,7 +287,7 @@ async def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -288,13 +304,16 @@ async def get_version( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -305,11 +324,13 @@ async def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,7 +358,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -353,13 +374,16 @@ def list_versions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -370,9 +394,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -383,9 +409,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py index 7d6a491cc471..c32e9eefdd49 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py index 719cb8750ff7..316b56edf0f1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -52,7 +51,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,13 +66,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -83,11 +85,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -116,9 +120,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -135,14 +139,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -155,11 +162,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -190,14 +199,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -207,11 +219,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -247,7 +261,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -271,35 +285,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py index a2405335de5e..abfe6cd3dfbb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py index c7f131641278..35ea6f58e743 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -130,37 +134,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -178,9 +192,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -194,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -213,11 +230,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -260,13 +279,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,11 +297,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -302,7 +326,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,13 +338,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -329,11 +356,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -360,9 +389,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -378,14 +407,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -398,11 +430,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -433,7 +467,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -447,13 +481,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -463,9 +500,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -475,9 +514,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -515,7 +556,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -526,13 +567,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +585,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -552,9 +598,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +639,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -601,13 +649,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -615,9 +666,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -625,9 +678,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -666,7 +721,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -678,13 +733,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -693,11 +751,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -724,13 +784,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -739,11 +802,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,20 +850,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -808,8 +878,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -827,7 +903,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -845,14 +921,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -862,9 +941,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -874,9 +955,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -912,9 +995,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -924,14 +1007,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -941,11 +1027,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py index a06eaad61a37..9b9f5d4fc734 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/__init__.py @@ -69,7 +69,9 @@ StoragePermissions, VaultProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'Attributes', @@ -131,3 +133,5 @@ 'StoragePermissions', 'VaultProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py index b1639786c8e3..bd3253f802a8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_key_vault_management_client_enums.py @@ -7,17 +7,16 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -37,14 +36,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -55,7 +54,7 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -64,7 +63,7 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -77,7 +76,7 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNWRAP_KEY = "unwrapKey" IMPORT_ENUM = "import" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -86,7 +85,7 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" ENCRYPT = "encrypt" @@ -106,7 +105,7 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -114,7 +113,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -122,7 +121,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -133,7 +132,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -142,7 +141,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -150,7 +149,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -162,20 +161,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -193,7 +192,7 @@ class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py index 66457d2dd8f0..f5dca3befdbb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_models_py3.py @@ -6,11 +6,13 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -49,7 +51,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -91,8 +93,8 @@ class Attributes(msrest.serialization.Model): :vartype updated: long :ivar recovery_level: The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel """ @@ -147,8 +149,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2019_09_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -243,7 +244,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -274,7 +275,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -479,15 +480,15 @@ class Key(Resource): :vartype tags: dict[str, str] :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -523,25 +524,25 @@ class Key(Resource): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName """ super(Key, self).__init__(**kwargs) @@ -571,8 +572,8 @@ class KeyAttributes(Attributes): :vartype updated: long :ivar recovery_level: The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2019_09_01.models.DeletionRecoveryLevel """ @@ -634,7 +635,7 @@ class KeyCreateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "KeyProperties", + properties: "_models.KeyProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -666,7 +667,7 @@ class KeyListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Key"]] = None, + value: Optional[List["_models.Key"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -688,15 +689,15 @@ class KeyProperties(msrest.serialization.Model): :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -722,25 +723,25 @@ class KeyProperties(msrest.serialization.Model): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2019_09_01.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2019_09_01.models.JsonWebKeyCurveName """ super(KeyProperties, self).__init__(**kwargs) @@ -845,7 +846,7 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, supported_time_grain_types: Optional[List[str]] = None, lock_aggregation_type: Optional[str] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, internal_metric_name: Optional[str] = None, **kwargs @@ -893,11 +894,11 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :ivar ip_rules: The list of IP address rules. @@ -917,20 +918,20 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. :paramtype ip_rules: list[~azure.mgmt.keyvault.v2019_09_01.models.IPRule] @@ -972,10 +973,10 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -1061,7 +1062,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1100,10 +1101,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -1173,8 +1174,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -1204,8 +1205,8 @@ def __init__( self, *, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -1238,8 +1239,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnectionProvisioningState """ @@ -1261,8 +1262,8 @@ def __init__( *, id: Optional[str] = None, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -1358,7 +1359,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -1373,7 +1374,7 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. @@ -1392,14 +1393,14 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, actions_required: Optional[str] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. @@ -1431,7 +1432,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1464,8 +1465,8 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -1485,10 +1486,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ @@ -1505,15 +1506,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2019_09_01.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -1561,7 +1562,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -1621,7 +1622,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -1657,7 +1658,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -1737,7 +1738,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1773,7 +1774,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1806,7 +1807,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -1853,7 +1854,7 @@ class VaultPatchProperties(msrest.serialization.Model): :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :vartype soft_delete_retention_in_days: int :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -1885,17 +1886,17 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, enable_rbac_authorization: Optional[bool] = None, soft_delete_retention_in_days: Optional[int] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, **kwargs ): """ @@ -1930,7 +1931,7 @@ def __init__( <=90. :paramtype soft_delete_retention_in_days: int :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2002,7 +2003,7 @@ class VaultProperties(msrest.serialization.Model): the default value of false. Note that management actions are always authorized with RBAC. :vartype enable_rbac_authorization: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -2013,8 +2014,8 @@ class VaultProperties(msrest.serialization.Model): :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. :vartype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the @@ -2053,8 +2054,8 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, @@ -2062,10 +2063,10 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_rbac_authorization: Optional[bool] = False, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, - provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, **kwargs ): """ @@ -2106,7 +2107,7 @@ def __init__( the default value of false. Note that management actions are always authorized with RBAC. :paramtype enable_rbac_authorization: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2019_09_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2117,8 +2118,8 @@ def __init__( :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2019_09_01.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2019_09_01.models.VaultProvisioningState """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py index 7b62b7166158..a30353f460a6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/__init__.py @@ -12,6 +12,9 @@ from ._operations import Operations from ._keys_operations import KeysOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', @@ -19,3 +22,5 @@ 'Operations', 'KeysOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py index 01d6596e40de..fc627fb17a15 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_keys_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_if_not_exist_request( vault_name: str, key_name: str, *, - json: JSONType = None, + json: Optional[_models.KeyCreateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_if_not_exist_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -80,9 +81,12 @@ def build_get_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -95,18 +99,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -117,9 +119,12 @@ def build_list_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys") # pylint: disable=line-too-long path_format_arguments = { @@ -131,18 +136,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -155,9 +158,12 @@ def build_get_version_request( key_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_get_version_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_versions_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions") # pylint: disable=line-too-long path_format_arguments = { @@ -209,42 +216,38 @@ def build_list_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class KeysOperations(object): - """KeysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_if_not_exist( @@ -252,9 +255,9 @@ def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -273,14 +276,17 @@ def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -293,11 +299,13 @@ def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,7 +333,7 @@ def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -340,13 +348,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -356,11 +367,13 @@ def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -387,7 +400,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -400,13 +413,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -416,9 +432,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -428,9 +446,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -471,7 +491,7 @@ def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -488,13 +508,16 @@ def get_version( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -505,11 +528,13 @@ def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -537,7 +562,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -552,13 +577,16 @@ def list_versions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -569,9 +597,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -582,9 +612,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py index 05b12bc02196..3b7d579cc8ff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py index 1e873e0e975b..023aa174579f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -50,18 +53,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,14 +73,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -92,20 +96,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,9 +121,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -134,42 +139,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -178,7 +179,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -193,13 +194,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -209,11 +213,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -242,9 +248,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -261,14 +267,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -281,11 +290,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,14 +327,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -333,11 +347,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -373,7 +389,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -397,35 +413,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py index 0fa91903950d..4538b89d0713 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py index 820398333330..413fd4c34c7e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2019_09_01/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -195,14 +199,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -215,20 +222,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -242,9 +247,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -255,20 +263,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -279,9 +285,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -291,20 +300,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -313,9 +320,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -325,18 +335,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -347,9 +355,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -361,18 +372,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -383,9 +392,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -397,18 +409,16 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -419,10 +429,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -432,21 +445,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -454,14 +465,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -471,62 +485,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2019_09_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2019_09_01.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -538,11 +551,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,9 +587,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -595,37 +610,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2019_09_01.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,9 +668,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -659,14 +684,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -678,11 +706,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,13 +755,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -740,11 +773,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -767,7 +802,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -779,13 +814,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -794,11 +832,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -825,9 +865,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -843,14 +883,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -863,11 +906,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +943,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -911,13 +956,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -927,9 +975,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -939,9 +989,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -979,7 +1031,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -989,13 +1041,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1004,9 +1059,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1015,9 +1072,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1054,7 +1113,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1064,13 +1123,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1078,9 +1140,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1088,9 +1152,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1129,7 +1195,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1141,13 +1207,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1156,11 +1225,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1187,13 +1258,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2019-09-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1202,11 +1276,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1248,20 +1324,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2019-09-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1271,8 +1352,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1290,7 +1377,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1308,14 +1395,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2019_09_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1325,9 +1415,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1337,9 +1429,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1375,9 +1469,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1387,14 +1481,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2019_09_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2019-09-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-09-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1404,11 +1501,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py index 84301498d001..f97b3b77081e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_key_vault_management_client.py @@ -70,13 +70,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py index e1f61c2784b5..b257f5440087 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/_key_vault_management_client.py @@ -71,13 +71,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/__init__.py index 296660e7d1a6..d8c247e50c9e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._secrets_operations import SecretsOperations from ._managed_hsms_operations import ManagedHsmsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -23,3 +26,5 @@ 'SecretsOperations', 'ManagedHsmsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py index 6ff76f452971..a1dbc4dc05b1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_keys_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeysOperations: - """KeysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_if_not_exist( @@ -51,9 +50,9 @@ async def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -72,14 +71,17 @@ async def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -92,11 +94,13 @@ async def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -124,7 +128,7 @@ async def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -139,13 +143,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -155,11 +162,13 @@ async def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -186,7 +195,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -200,13 +209,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -216,9 +228,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +242,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -271,7 +287,7 @@ async def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -288,13 +304,16 @@ async def get_version( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -305,11 +324,13 @@ async def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,7 +358,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -353,13 +374,16 @@ def list_versions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -370,9 +394,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -383,9 +409,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py index 4e1c36b37124..55374eab2bda 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedHsmsOperations: - """ManagedHsmsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -132,37 +136,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,17 +193,20 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -201,11 +218,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -235,9 +254,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -260,37 +279,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -309,13 +338,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -324,11 +356,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -370,20 +404,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -393,8 +432,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -413,7 +458,7 @@ async def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -425,13 +470,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -440,11 +488,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,7 +524,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -489,13 +539,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -505,9 +558,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -517,9 +572,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -558,7 +615,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -571,13 +628,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -586,9 +646,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -597,9 +659,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py index 626da6ca73e0..5b55d76773dc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index b13087cb1fac..0c8283d2bddd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -14,6 +14,7 @@ from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -52,7 +51,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -67,13 +66,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -83,11 +85,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -116,9 +120,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -135,14 +139,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -155,11 +162,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -190,14 +199,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -207,11 +219,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -247,7 +261,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -271,35 +285,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py index b8aa14d54a77..cd4dc86114a1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py index d7ed082ab49b..fa95da12bf0a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_secrets_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SecretsOperations: - """SecretsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_or_update( @@ -51,9 +50,9 @@ async def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -72,14 +71,17 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -92,11 +94,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -127,9 +131,9 @@ async def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -147,14 +151,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -167,11 +174,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -203,7 +212,7 @@ async def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -218,13 +227,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -234,11 +246,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -266,7 +280,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -283,13 +297,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -300,9 +317,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +332,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py index 24276ad9142c..123767e09c27 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -131,37 +135,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,9 +193,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -195,14 +209,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -214,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -261,13 +280,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -276,11 +298,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -303,7 +327,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -315,13 +339,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -330,11 +357,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +390,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -380,14 +409,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -400,11 +432,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -435,7 +469,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,13 +483,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -465,9 +502,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -477,9 +516,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -517,7 +558,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -528,13 +569,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -543,9 +587,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -554,9 +600,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -593,7 +641,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -603,13 +651,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -617,9 +668,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -627,9 +680,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -668,7 +723,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -680,13 +735,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -695,11 +753,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -726,13 +786,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -741,11 +804,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,20 +852,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -810,8 +880,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -829,7 +905,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -847,14 +923,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -864,9 +943,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -876,9 +957,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -914,9 +997,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -927,14 +1010,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -944,11 +1030,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py index 6d63ffe92248..a93739cc85b3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/__init__.py @@ -89,7 +89,9 @@ StoragePermissions, VaultProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'Attributes', @@ -171,3 +173,5 @@ 'StoragePermissions', 'VaultProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py index 23be3c2ce791..89b6bbd0af3d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_key_vault_management_client_enums.py @@ -7,23 +7,22 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -42,14 +41,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -60,7 +59,7 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity. """ @@ -69,7 +68,7 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -78,7 +77,7 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -91,7 +90,7 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNWRAP_KEY = "unwrapKey" IMPORT_ENUM = "import" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -100,7 +99,7 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -119,20 +118,20 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -140,7 +139,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -148,7 +147,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -159,7 +158,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -168,7 +167,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state. """ @@ -189,7 +188,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -197,7 +196,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -208,20 +207,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -238,7 +237,7 @@ class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py index 92673a41c401..1cc1320b2c49 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -51,7 +53,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -140,8 +142,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -236,7 +237,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -267,7 +268,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -509,16 +510,16 @@ class Key(Resource): :vartype tags: dict[str, str] :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -554,26 +555,26 @@ class Key(Resource): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName """ @@ -604,8 +605,8 @@ class KeyAttributes(msrest.serialization.Model): :vartype updated: long :ivar recovery_level: The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletionRecoveryLevel @@ -674,7 +675,7 @@ class KeyCreateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "KeyProperties", + properties: "_models.KeyProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -706,7 +707,7 @@ class KeyListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Key"]] = None, + value: Optional[List["_models.Key"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -728,16 +729,16 @@ class KeyProperties(msrest.serialization.Model): :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -763,26 +764,26 @@ class KeyProperties(msrest.serialization.Model): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.JsonWebKeyCurveName """ @@ -873,7 +874,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -935,9 +936,9 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ManagedHsmProperties"] = None, + properties: Optional["_models.ManagedHsmProperties"] = None, **kwargs ): """ @@ -998,7 +999,7 @@ class ManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedHsm"]] = None, + value: Optional[List["_models.ManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1040,13 +1041,12 @@ class ManagedHsmProperties(msrest.serialization.Model): this functionality is irreversible. :vartype enable_purge_protection: bool :ivar create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". + :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Provisioning", + "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ProvisioningState """ @@ -1077,7 +1077,7 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_purge_protection: Optional[bool] = True, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, **kwargs ): """ @@ -1102,7 +1102,7 @@ def __init__( Enabling this functionality is irreversible. :paramtype enable_purge_protection: bool :keyword create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode """ super(ManagedHsmProperties, self).__init__(**kwargs) @@ -1122,9 +1122,9 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :ivar family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :vartype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily - :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :vartype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName """ @@ -1142,14 +1142,14 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"] = "B", - name: Union[str, "ManagedHsmSkuName"], + family: Union[str, "_models.ManagedHsmSkuFamily"] = "B", + name: Union[str, "_models.ManagedHsmSkuName"], **kwargs ): """ - :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :keyword family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :paramtype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuFamily - :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :keyword name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :paramtype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmSkuName """ @@ -1211,7 +1211,7 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, supported_time_grain_types: Optional[List[str]] = None, lock_aggregation_type: Optional[str] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, internal_metric_name: Optional[str] = None, **kwargs @@ -1260,12 +1260,12 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction @@ -1286,21 +1286,21 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. @@ -1344,10 +1344,10 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -1434,7 +1434,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1475,10 +1475,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -1550,8 +1550,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1581,8 +1581,8 @@ def __init__( self, *, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -1615,8 +1615,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1638,8 +1638,8 @@ def __init__( *, id: Optional[str] = None, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, **kwargs ): """ @@ -1735,7 +1735,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -1750,13 +1750,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired """ @@ -1770,20 +1770,20 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.ActionsRequired """ @@ -1810,7 +1810,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1867,7 +1867,7 @@ class Secret(Resource): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", **kwargs ): """ @@ -1950,7 +1950,7 @@ class SecretCreateOrUpdateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1982,7 +1982,7 @@ class SecretListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Secret"]] = None, + value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2015,7 +2015,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["SecretPatchProperties"] = None, + properties: Optional["_models.SecretPatchProperties"] = None, **kwargs ): """ @@ -2051,7 +2051,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -2105,7 +2105,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -2145,8 +2145,8 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -2167,10 +2167,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName """ @@ -2187,15 +2187,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -2208,15 +2208,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created key vault resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created key vault resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :ivar created_by_type: The type of identity that created key vault resource. Known values are: + "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType :ivar created_at: The timestamp of key vault resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified key vault resource. :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + :ivar last_modified_by_type: The type of identity that last modified key vault resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType :ivar last_modified_at: The timestamp of key vault resource last modification (UTC). @@ -2236,25 +2236,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created key vault resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created key vault resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created key vault resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType :keyword created_at: The timestamp of key vault resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified key vault resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.IdentityType :keyword last_modified_at: The timestamp of key vault resource last modification (UTC). @@ -2313,7 +2313,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -2375,7 +2375,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -2413,7 +2413,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -2494,7 +2494,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2530,7 +2530,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2563,7 +2563,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -2611,7 +2611,7 @@ class VaultPatchProperties(msrest.serialization.Model): :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :vartype soft_delete_retention_in_days: int :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -2643,17 +2643,17 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, enable_rbac_authorization: Optional[bool] = None, soft_delete_retention_in_days: Optional[int] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, **kwargs ): """ @@ -2689,7 +2689,7 @@ def __init__( <=90. :paramtype soft_delete_retention_in_days: int :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2759,7 +2759,7 @@ class VaultProperties(msrest.serialization.Model): the default value of false. Note that management actions are always authorized with RBAC. :vartype enable_rbac_authorization: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -2770,8 +2770,8 @@ class VaultProperties(msrest.serialization.Model): :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. :vartype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the @@ -2808,8 +2808,8 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, @@ -2817,10 +2817,10 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_rbac_authorization: Optional[bool] = False, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, - provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, **kwargs ): """ @@ -2861,7 +2861,7 @@ def __init__( the default value of false. Note that management actions are always authorized with RBAC. :paramtype enable_rbac_authorization: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2872,8 +2872,8 @@ def __init__( :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2020_04_01_preview.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultProvisioningState """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py index 296660e7d1a6..d8c247e50c9e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/__init__.py @@ -14,6 +14,9 @@ from ._secrets_operations import SecretsOperations from ._managed_hsms_operations import ManagedHsmsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -23,3 +26,5 @@ 'SecretsOperations', 'ManagedHsmsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py index 5b3f4257ca96..620d675c95aa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_keys_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_if_not_exist_request( vault_name: str, key_name: str, *, - json: JSONType = None, + json: Optional[_models.KeyCreateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_if_not_exist_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -80,9 +81,12 @@ def build_get_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -95,18 +99,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -117,9 +119,12 @@ def build_list_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys") # pylint: disable=line-too-long path_format_arguments = { @@ -131,18 +136,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -155,9 +158,12 @@ def build_get_version_request( key_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_get_version_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_versions_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions") # pylint: disable=line-too-long path_format_arguments = { @@ -209,42 +216,38 @@ def build_list_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class KeysOperations(object): - """KeysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_if_not_exist( @@ -252,9 +255,9 @@ def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -273,14 +276,17 @@ def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -293,11 +299,13 @@ def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,7 +333,7 @@ def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -340,13 +348,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -356,11 +367,13 @@ def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -387,7 +400,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -401,13 +414,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -417,9 +433,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -429,9 +447,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -472,7 +492,7 @@ def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -489,13 +509,16 @@ def get_version( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -506,11 +529,13 @@ def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -538,7 +563,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -554,13 +579,16 @@ def list_versions( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -571,9 +599,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -584,9 +614,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py index 118b334f4267..45bd72f43730 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -196,9 +200,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +216,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -233,9 +238,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") path_format_arguments = { @@ -245,60 +253,59 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedHsmsOperations(object): - """ManagedHsmsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -310,11 +317,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -344,9 +353,9 @@ def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -368,37 +377,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -415,17 +434,20 @@ def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -437,11 +459,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -471,9 +495,9 @@ def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -495,37 +519,47 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -544,13 +578,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -559,11 +596,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -605,20 +644,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -628,8 +672,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -648,7 +698,7 @@ def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -660,13 +710,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -675,11 +728,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -709,7 +764,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -724,13 +779,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -740,9 +798,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -752,9 +812,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -793,7 +855,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -806,13 +868,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -821,9 +886,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -832,9 +899,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py index 171fff2a00d5..bfc3388e0dce 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py index 4d2ef4a3a4ca..b29fae0a27cb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from msrest import Serializer @@ -16,13 +16,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -50,18 +53,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,14 +73,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -92,20 +96,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -119,9 +121,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -134,42 +139,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -178,7 +179,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -193,13 +194,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -209,11 +213,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -242,9 +248,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -261,14 +267,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -281,11 +290,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -316,14 +327,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -333,11 +347,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -373,7 +389,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -397,35 +413,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py index 566a40ae750d..79053ec272c4 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py index 4f4372286a55..1a7823f6be91 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_secrets_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_or_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -79,14 +80,17 @@ def build_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -99,20 +103,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -126,9 +128,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -141,18 +146,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -165,9 +168,12 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") # pylint: disable=line-too-long path_format_arguments = { @@ -179,44 +185,40 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SecretsOperations(object): - """SecretsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_or_update( @@ -224,9 +226,9 @@ def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -245,14 +247,17 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -265,11 +270,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -300,9 +307,9 @@ def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -320,14 +327,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -340,11 +350,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -376,7 +388,7 @@ def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -391,13 +403,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -407,11 +422,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -439,7 +456,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.SecretListResult"]: + ) -> Iterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -456,13 +473,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -473,9 +493,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -486,9 +508,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py index cff56202b0da..cfabd8b66e13 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2020_04_01_preview/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -195,14 +199,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -215,20 +222,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -242,9 +247,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -255,20 +263,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -279,9 +285,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -291,20 +300,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -313,9 +320,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -325,18 +335,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -347,9 +355,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -361,18 +372,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -383,9 +392,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -397,18 +409,16 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -419,10 +429,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -432,21 +445,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -454,14 +465,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -471,62 +485,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2020_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2020_04_01_preview.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -538,11 +551,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,9 +587,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -595,37 +610,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,9 +668,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -659,14 +684,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -678,11 +706,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,13 +755,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -740,11 +773,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -767,7 +802,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -779,13 +814,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -794,11 +832,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -825,9 +865,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -844,14 +884,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -864,11 +907,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -899,7 +944,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -913,13 +958,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -929,9 +977,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -941,9 +991,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -981,7 +1033,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -992,13 +1044,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1007,9 +1062,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1018,9 +1075,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1057,7 +1116,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1067,13 +1126,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1081,9 +1143,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1091,9 +1155,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1132,7 +1198,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1144,13 +1210,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1159,11 +1228,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1190,13 +1261,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1205,11 +1279,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1251,20 +1327,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2020-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1274,8 +1355,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1293,7 +1380,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1311,14 +1398,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2020_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1328,9 +1418,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1340,9 +1432,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1378,9 +1472,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1391,14 +1485,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2020_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2020-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1408,11 +1505,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py index 73603ba564f5..fe22de668716 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_key_vault_management_client.py @@ -72,13 +72,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py index a0ae2bfc59ee..88b5f2ea8cb0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/_key_vault_management_client.py @@ -73,13 +73,27 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py index fadc1d60816b..1ab91d2ad823 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', @@ -23,3 +26,5 @@ 'MHSMPrivateLinkResourcesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py index 22d336698d9e..9e0e1a22361f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedHsmsOperations: - """ManagedHsmsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -132,37 +136,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,17 +193,20 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -201,11 +218,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -216,14 +235,17 @@ async def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -235,9 +257,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -260,37 +282,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -309,13 +341,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -324,11 +359,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -370,20 +407,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -393,8 +435,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -413,7 +461,7 @@ async def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -425,13 +473,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -440,11 +491,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,7 +527,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -489,13 +542,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -505,9 +561,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -517,9 +575,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -558,7 +618,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -571,13 +631,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -586,9 +649,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -597,9 +662,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -637,7 +704,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedManagedHsmListResult"]: + ) -> AsyncIterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -648,13 +715,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -662,9 +732,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -672,9 +744,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -714,7 +788,7 @@ async def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -726,13 +800,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -741,11 +818,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -773,13 +852,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -788,11 +870,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,20 +918,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -857,8 +946,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index 3d0785e83ee0..1b5e0a92b554 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateEndpointConnectionsOperations: - """MHSMPrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -53,7 +52,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> AsyncIterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> AsyncIterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -68,13 +67,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -170,11 +179,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,9 +213,9 @@ async def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -221,14 +232,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -241,11 +255,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,14 +292,17 @@ async def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -293,11 +312,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -333,7 +354,7 @@ async def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -357,35 +378,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py index 5f37446f5921..dd930eae9d4f 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_mhsm_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateLinkResourcesOperations: - """MHSMPrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_mhsm_resource( @@ -49,7 +48,7 @@ async def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -61,13 +60,16 @@ async def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -76,11 +78,13 @@ async def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py index 7639b06f575f..52104e00ff3e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py index 209b827dea1d..d23e84cd1c75 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -54,7 +53,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -69,13 +68,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -85,11 +87,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -118,9 +122,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -137,14 +141,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -157,11 +164,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -192,14 +201,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -209,11 +221,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,7 +263,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -273,35 +287,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -320,7 +344,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -335,13 +359,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -351,9 +378,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -363,9 +392,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py index 7be8395b32a8..1e31dc77d60c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py index e840f0832f5d..0c3a0fbf8bd8 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -131,37 +135,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,9 +193,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -195,14 +209,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -214,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -261,13 +280,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -276,11 +298,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -303,7 +327,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -315,13 +339,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -330,11 +357,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +390,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -380,14 +409,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -400,11 +432,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -435,7 +469,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,13 +483,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -465,9 +502,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -477,9 +516,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -517,7 +558,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -528,13 +569,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -543,9 +587,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -554,9 +600,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -593,7 +641,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -603,13 +651,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -617,9 +668,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -627,9 +680,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -668,7 +723,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -680,13 +735,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -695,11 +753,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -726,13 +786,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -741,11 +804,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,20 +852,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -810,8 +880,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -829,7 +905,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -847,14 +923,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -864,9 +943,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -876,9 +957,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -914,9 +997,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -927,14 +1010,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -944,11 +1030,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py index 880cf9b10ff8..f26a52d26fd7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/__init__.py @@ -87,7 +87,9 @@ StoragePermissions, VaultProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'CheckNameAvailabilityResult', @@ -167,3 +169,5 @@ 'StoragePermissions', 'VaultProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py index 8d18d1a014f6..9be18cf6d969 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_key_vault_management_client_enums.py @@ -7,23 +7,22 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -42,14 +41,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity. """ @@ -58,7 +57,7 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ENCRYPT = "encrypt" DECRYPT = "decrypt" @@ -78,20 +77,20 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): PURGE = "purge" RELEASE = "release" -class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -99,7 +98,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -107,7 +106,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -118,7 +117,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -127,7 +126,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state. """ @@ -148,7 +147,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -156,7 +155,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -164,7 +163,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -175,20 +174,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): GET = "get" LIST = "list" @@ -205,7 +204,7 @@ class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py index 38c115cdb291..6b21cdcf6043 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -51,7 +53,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -86,8 +88,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -183,7 +184,7 @@ class DeletedManagedHsm(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedManagedHsmProperties"] = None, + properties: Optional["_models.DeletedManagedHsmProperties"] = None, **kwargs ): """ @@ -215,7 +216,7 @@ class DeletedManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedManagedHsm"]] = None, + value: Optional[List["_models.DeletedManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -313,7 +314,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -344,7 +345,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -604,7 +605,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -672,9 +673,9 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ManagedHsmProperties"] = None, + properties: Optional["_models.ManagedHsmProperties"] = None, **kwargs ): """ @@ -735,7 +736,7 @@ class ManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedHsm"]] = None, + value: Optional[List["_models.ManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -777,13 +778,12 @@ class ManagedHsmProperties(msrest.serialization.Model): this functionality is irreversible. :vartype enable_purge_protection: bool :ivar create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". + :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Provisioning", + "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ProvisioningState :ivar network_acls: Rules governing the accessibility of the key vault from specific network @@ -794,7 +794,7 @@ class ManagedHsmProperties(msrest.serialization.Model): :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionItem] :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PublicNetworkAccess :ivar scheduled_purge_date: The scheduled purge date in UTC. @@ -833,9 +833,9 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_purge_protection: Optional[bool] = True, - create_mode: Optional[Union[str, "CreateMode"]] = None, - network_acls: Optional["MHSMNetworkRuleSet"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -860,13 +860,13 @@ def __init__( Enabling this functionality is irreversible. :paramtype enable_purge_protection: bool :keyword create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMNetworkRuleSet :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PublicNetworkAccess """ @@ -891,9 +891,9 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :ivar family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :vartype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily - :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :vartype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName """ @@ -911,14 +911,14 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"] = "B", - name: Union[str, "ManagedHsmSkuName"], + family: Union[str, "_models.ManagedHsmSkuFamily"] = "B", + name: Union[str, "_models.ManagedHsmSkuName"], **kwargs ): """ - :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :keyword family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :paramtype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuFamily - :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :keyword name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :paramtype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmSkuName """ @@ -980,7 +980,7 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, supported_time_grain_types: Optional[List[str]] = None, lock_aggregation_type: Optional[str] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, internal_metric_name: Optional[str] = None, **kwargs @@ -1062,12 +1062,12 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a managed hsm pool. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction @@ -1088,21 +1088,21 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["MHSMIPRule"]] = None, - virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.MHSMIPRule"]] = None, + virtual_network_rules: Optional[List["_models.MHSMVirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. @@ -1172,8 +1172,8 @@ class MHSMPrivateEndpointConnection(ManagedHsmResource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1203,12 +1203,12 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -1226,8 +1226,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1241,18 +1241,24 @@ def __init__( class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str :ivar private_endpoint: Properties of the private endpoint object. :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1261,24 +1267,32 @@ class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str :keyword private_endpoint: Properties of the private endpoint object. :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpoint :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state @@ -1302,7 +1316,7 @@ class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateEndpointConnection"]] = None, + value: Optional[List["_models.MHSMPrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1372,7 +1386,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, required_zone_names: Optional[List[str]] = None, **kwargs @@ -1407,7 +1421,7 @@ class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateLinkResource"]] = None, + value: Optional[List["_models.MHSMPrivateLinkResource"]] = None, **kwargs ): """ @@ -1422,13 +1436,13 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ @@ -1442,20 +1456,20 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ @@ -1502,12 +1516,12 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction @@ -1528,21 +1542,21 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. @@ -1586,10 +1600,10 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -1676,7 +1690,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1717,10 +1731,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -1839,8 +1853,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1869,9 +1883,9 @@ def __init__( self, *, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -1882,8 +1896,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1906,8 +1920,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1925,9 +1939,9 @@ def __init__( *, id: Optional[str] = None, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -1940,8 +1954,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1970,7 +1984,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2060,7 +2074,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -2075,13 +2089,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ @@ -2095,20 +2109,20 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.ActionsRequired """ @@ -2135,7 +2149,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2169,8 +2183,8 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -2191,10 +2205,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName """ @@ -2211,15 +2225,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -2232,15 +2246,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the key vault resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar created_by_type: The type of identity that created the key vault resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType :ivar created_at: The timestamp of the key vault resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the key vault resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). @@ -2260,25 +2274,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the key vault resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the key vault resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType :keyword created_at: The timestamp of the key vault resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the key vault resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.IdentityType :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). @@ -2337,7 +2351,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -2399,7 +2413,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -2437,7 +2451,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -2518,7 +2532,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2554,7 +2568,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2587,7 +2601,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -2635,7 +2649,7 @@ class VaultPatchProperties(msrest.serialization.Model): :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :vartype soft_delete_retention_in_days: int :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -2667,17 +2681,17 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, enable_rbac_authorization: Optional[bool] = None, soft_delete_retention_in_days: Optional[int] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, **kwargs ): """ @@ -2713,7 +2727,7 @@ def __init__( <=90. :paramtype soft_delete_retention_in_days: int :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2785,7 +2799,7 @@ class VaultProperties(msrest.serialization.Model): the default value of false. Note that management actions are always authorized with RBAC. :vartype enable_rbac_authorization: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -2796,8 +2810,8 @@ class VaultProperties(msrest.serialization.Model): :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. :vartype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the @@ -2836,8 +2850,8 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, @@ -2845,10 +2859,10 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_rbac_authorization: Optional[bool] = False, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, - provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, **kwargs ): """ @@ -2889,7 +2903,7 @@ def __init__( the default value of false. Note that management actions are always authorized with RBAC. :paramtype enable_rbac_authorization: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -2900,8 +2914,8 @@ def __init__( :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_04_01_preview.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultProvisioningState """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py index fadc1d60816b..1ab91d2ad823 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/__init__.py @@ -14,6 +14,9 @@ from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations from ._operations import Operations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'VaultsOperations', 'PrivateEndpointConnectionsOperations', @@ -23,3 +26,5 @@ 'MHSMPrivateLinkResourcesOperations', 'Operations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py index e0b12fab82f1..7c805a1d11e0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -196,9 +200,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +216,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -233,9 +238,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") path_format_arguments = { @@ -245,20 +253,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -267,9 +273,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs") path_format_arguments = { @@ -279,18 +288,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -301,9 +308,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -315,18 +325,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -337,9 +345,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -351,58 +362,57 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedHsmsOperations(object): - """ManagedHsmsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -414,11 +424,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -448,9 +460,9 @@ def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -472,37 +484,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -519,17 +541,20 @@ def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -541,11 +566,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -556,14 +583,17 @@ def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -575,9 +605,9 @@ def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -599,37 +629,47 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -648,13 +688,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -663,11 +706,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -709,20 +754,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -732,8 +782,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -752,7 +808,7 @@ def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -764,13 +820,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -779,11 +838,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -813,7 +874,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -828,13 +889,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -844,9 +908,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -856,9 +922,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -897,7 +965,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -910,13 +978,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -925,9 +996,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -936,9 +1009,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -976,7 +1051,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedManagedHsmListResult"]: + ) -> Iterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -987,13 +1062,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1001,9 +1079,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1011,9 +1091,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1053,7 +1135,7 @@ def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -1065,13 +1147,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -1080,11 +1165,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1112,13 +1199,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1127,11 +1217,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1173,20 +1265,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1196,8 +1293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index ab8962cc9a97..013bf679a1db 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_put_request( name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.MHSMPrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateEndpointConnectionsOperations(object): - """MHSMPrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -214,7 +216,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> Iterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -229,13 +231,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -331,11 +343,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -363,9 +377,9 @@ def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -382,14 +396,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -402,11 +419,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -437,14 +456,17 @@ def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -454,11 +476,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,7 +518,7 @@ def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> LROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -518,35 +542,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py index b4e682147c34..8a1fb4b3b6d9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_mhsm_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_mhsm_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_mhsm_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateLinkResourcesOperations(object): - """MHSMPrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_mhsm_resource( @@ -88,7 +88,7 @@ def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -100,13 +100,16 @@ def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -115,11 +118,13 @@ def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py index 730b83a0e0a0..edb934cb4481 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py index 22216a6d43b2..bf4b63ea92bd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -120,9 +122,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -135,18 +140,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -157,9 +160,12 @@ def build_list_by_resource_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -215,7 +217,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -230,13 +232,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -246,11 +251,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -279,9 +286,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -298,14 +305,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -318,11 +328,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -353,14 +365,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -370,11 +385,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,7 +427,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -434,35 +451,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -481,7 +508,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -496,13 +523,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -512,9 +542,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -524,9 +556,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py index 4c3ce129cd7a..eead3e778034 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py index 65b401aa7a92..d744091e85d6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_04_01_preview/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -195,14 +199,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -215,20 +222,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -242,9 +247,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -255,20 +263,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -279,9 +285,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -291,20 +300,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -313,9 +320,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -325,18 +335,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -347,9 +355,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -361,18 +372,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -383,9 +392,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -397,18 +409,16 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -419,10 +429,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -432,21 +445,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -454,14 +465,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -471,62 +485,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_04_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_04_01_preview.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -538,11 +551,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,9 +587,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -595,37 +610,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,9 +668,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -659,14 +684,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -678,11 +706,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,13 +755,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -740,11 +773,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -767,7 +802,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -779,13 +814,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -794,11 +832,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -825,9 +865,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -844,14 +884,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -864,11 +907,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -899,7 +944,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -913,13 +958,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -929,9 +977,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -941,9 +991,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -981,7 +1033,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -992,13 +1044,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1007,9 +1062,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1018,9 +1075,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1057,7 +1116,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1067,13 +1126,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1081,9 +1143,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1091,9 +1155,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1132,7 +1198,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1144,13 +1210,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1159,11 +1228,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1190,13 +1261,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1205,11 +1279,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1251,20 +1327,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-04-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1274,8 +1355,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1293,7 +1380,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1311,14 +1398,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_04_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1328,9 +1418,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1340,9 +1432,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1378,9 +1472,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1391,14 +1485,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_04_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-04-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-04-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1408,11 +1505,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py index b9bef8fb4b50..d8af90513778 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_key_vault_management_client.py @@ -76,15 +76,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py index caad007e1073..626262d5826c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/_key_vault_management_client.py @@ -77,15 +77,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py index 8e1d8528d945..49be258e3efc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/__init__.py @@ -16,6 +16,9 @@ from ._operations import Operations from ._secrets_operations import SecretsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -27,3 +30,5 @@ 'Operations', 'SecretsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py index 5ed8a9f68b07..1d78ac893f9c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_keys_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeysOperations: - """KeysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_if_not_exist( @@ -51,9 +50,9 @@ async def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -72,14 +71,17 @@ async def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -92,11 +94,13 @@ async def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -124,7 +128,7 @@ async def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -139,13 +143,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -155,11 +162,13 @@ async def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -186,7 +195,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -200,13 +209,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -216,9 +228,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +242,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -271,7 +287,7 @@ async def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -288,13 +304,16 @@ async def get_version( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -305,11 +324,13 @@ async def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,7 +358,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -353,13 +374,16 @@ def list_versions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -370,9 +394,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -383,9 +409,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py index 11698a43bb15..a48e064ef39e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedHsmsOperations: - """ManagedHsmsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -132,37 +136,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,17 +193,20 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -201,11 +218,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -216,14 +235,17 @@ async def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -235,9 +257,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -260,37 +282,47 @@ async def begin_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -309,13 +341,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -324,11 +359,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -370,20 +407,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -393,8 +435,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -413,7 +461,7 @@ async def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -425,13 +473,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -440,11 +491,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -474,7 +527,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -489,13 +542,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -505,9 +561,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -517,9 +575,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -558,7 +618,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -571,13 +631,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -586,9 +649,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -597,9 +662,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -637,7 +704,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedManagedHsmListResult"]: + ) -> AsyncIterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -648,13 +715,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -662,9 +732,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -672,9 +744,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -714,7 +788,7 @@ async def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -726,13 +800,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -741,11 +818,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -773,13 +852,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -788,11 +870,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -834,20 +918,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -857,8 +946,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py index 4f774a58b927..3aa1cd9f773b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateEndpointConnectionsOperations: - """MHSMPrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -53,7 +52,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> AsyncIterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> AsyncIterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -68,13 +67,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -170,11 +179,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,9 +213,9 @@ async def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -221,14 +232,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -241,11 +255,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,14 +292,17 @@ async def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -293,11 +312,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -333,7 +354,7 @@ async def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -357,35 +378,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py index baac2f1e1d02..5094486e9912 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_mhsm_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateLinkResourcesOperations: - """MHSMPrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_mhsm_resource( @@ -49,7 +48,7 @@ async def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -61,13 +60,16 @@ async def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -76,11 +78,13 @@ async def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py index a0522d0af432..2dbad436f634 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py index 91a46b0b5409..b58cce938b38 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -54,7 +53,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -69,13 +68,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -85,11 +87,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -118,9 +122,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -137,14 +141,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -157,11 +164,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -192,14 +201,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -209,11 +221,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,7 +263,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -273,35 +287,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -320,7 +344,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -335,13 +359,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -351,9 +378,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -363,9 +392,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py index e47023d3116e..7657ba2e2d7b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py index e5d971236f6b..67e198f2f99d 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_secrets_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SecretsOperations: - """SecretsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_or_update( @@ -51,9 +50,9 @@ async def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -72,14 +71,17 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -92,11 +94,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -127,9 +131,9 @@ async def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -147,14 +151,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -167,11 +174,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -203,7 +212,7 @@ async def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -218,13 +227,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -234,11 +246,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -266,7 +280,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -283,13 +297,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -300,9 +317,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -313,9 +332,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py index a60febafe6dd..25d7521388bb 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -131,37 +135,47 @@ async def begin_create_or_update( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -179,9 +193,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -195,14 +209,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -214,11 +231,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -261,13 +280,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -276,11 +298,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -303,7 +327,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -315,13 +339,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -330,11 +357,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -361,9 +390,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -380,14 +409,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -400,11 +432,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -435,7 +469,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -449,13 +483,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -465,9 +502,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -477,9 +516,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -517,7 +558,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -528,13 +569,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -543,9 +587,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -554,9 +600,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -593,7 +641,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -603,13 +651,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -617,9 +668,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -627,9 +680,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -668,7 +723,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -680,13 +735,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -695,11 +753,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -726,13 +786,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -741,11 +804,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -787,20 +852,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -810,8 +880,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -829,7 +905,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -847,14 +923,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -864,9 +943,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -876,9 +957,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -914,9 +997,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -927,14 +1010,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -944,11 +1030,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py index 6ef36695c13d..4bde73eeaac9 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/__init__.py @@ -111,7 +111,9 @@ StoragePermissions, VaultProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'Action', @@ -215,3 +217,5 @@ 'StoragePermissions', 'VaultProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py index a3b2078d010b..ce161ebed7bc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_key_vault_management_client_enums.py @@ -7,23 +7,22 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -43,14 +42,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -61,7 +60,7 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity. """ @@ -70,7 +69,7 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -79,7 +78,7 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -93,7 +92,7 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): IMPORT_ENUM = "import" RELEASE = "release" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -102,7 +101,7 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" ENCRYPT = "encrypt" @@ -126,27 +125,27 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SETROTATIONPOLICY = "setrotationpolicy" RELEASE = "release" -class KeyRotationPolicyActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyRotationPolicyActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of action. """ ROTATE = "rotate" NOTIFY = "notify" -class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -154,7 +153,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -162,7 +161,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -173,7 +172,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -182,7 +181,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state. """ @@ -203,7 +202,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -211,7 +210,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -219,7 +218,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -231,20 +230,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -262,7 +261,7 @@ class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py index a0f5c3e21330..b7f8c38d5287 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -51,7 +53,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -79,7 +81,7 @@ def __init__( class Action(msrest.serialization.Model): """Action. - :ivar type: The type of action. Possible values include: "rotate", "notify". + :ivar type: The type of action. Known values are: "rotate", "notify". :vartype type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType """ @@ -91,11 +93,11 @@ class Action(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "KeyRotationPolicyActionType"]] = None, + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, **kwargs ): """ - :keyword type: The type of action. Possible values include: "rotate", "notify". + :keyword type: The type of action. Known values are: "rotate", "notify". :paramtype type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyRotationPolicyActionType """ @@ -167,8 +169,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -264,7 +265,7 @@ class DeletedManagedHsm(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedManagedHsmProperties"] = None, + properties: Optional["_models.DeletedManagedHsmProperties"] = None, **kwargs ): """ @@ -296,7 +297,7 @@ class DeletedManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedManagedHsm"]] = None, + value: Optional[List["_models.DeletedManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -394,7 +395,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -425,7 +426,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -667,16 +668,16 @@ class Key(Resource): :vartype tags: dict[str, str] :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -720,28 +721,28 @@ class Key(Resource): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, - rotation_policy: Optional["RotationPolicy"] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["_models.RotationPolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :keyword rotation_policy: Key rotation policy in response. It will be used for both output and @@ -780,8 +781,8 @@ class KeyAttributes(msrest.serialization.Model): :vartype updated: long :ivar recovery_level: The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletionRecoveryLevel @@ -857,7 +858,7 @@ class KeyCreateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "KeyProperties", + properties: "_models.KeyProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -889,7 +890,7 @@ class KeyListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Key"]] = None, + value: Optional[List["_models.Key"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -911,16 +912,16 @@ class KeyProperties(msrest.serialization.Model): :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -954,28 +955,28 @@ class KeyProperties(msrest.serialization.Model): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, - rotation_policy: Optional["RotationPolicy"] = None, - release_policy: Optional["KeyReleasePolicy"] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["_models.RotationPolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.JsonWebKeyCurveName :keyword rotation_policy: Key rotation policy in response. It will be used for both output and @@ -1088,8 +1089,8 @@ class LifetimeAction(msrest.serialization.Model): def __init__( self, *, - trigger: Optional["Trigger"] = None, - action: Optional["Action"] = None, + trigger: Optional["_models.Trigger"] = None, + action: Optional["_models.Action"] = None, **kwargs ): """ @@ -1185,7 +1186,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1253,9 +1254,9 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ManagedHsmProperties"] = None, + properties: Optional["_models.ManagedHsmProperties"] = None, **kwargs ): """ @@ -1316,7 +1317,7 @@ class ManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedHsm"]] = None, + value: Optional[List["_models.ManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1358,13 +1359,12 @@ class ManagedHsmProperties(msrest.serialization.Model): this functionality is irreversible. :vartype enable_purge_protection: bool :ivar create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". + :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Provisioning", + "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ProvisioningState :ivar network_acls: Rules governing the accessibility of the key vault from specific network @@ -1375,7 +1375,7 @@ class ManagedHsmProperties(msrest.serialization.Model): :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionItem] :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess :ivar scheduled_purge_date: The scheduled purge date in UTC. @@ -1414,9 +1414,9 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_purge_protection: Optional[bool] = True, - create_mode: Optional[Union[str, "CreateMode"]] = None, - network_acls: Optional["MHSMNetworkRuleSet"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -1441,13 +1441,13 @@ def __init__( Enabling this functionality is irreversible. :paramtype enable_purge_protection: bool :keyword create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMNetworkRuleSet :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PublicNetworkAccess """ @@ -1472,9 +1472,9 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :ivar family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :vartype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily - :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :vartype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName """ @@ -1492,14 +1492,14 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"] = "B", - name: Union[str, "ManagedHsmSkuName"], + family: Union[str, "_models.ManagedHsmSkuFamily"] = "B", + name: Union[str, "_models.ManagedHsmSkuName"], **kwargs ): """ - :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :keyword family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :paramtype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuFamily - :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :keyword name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :paramtype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmSkuName """ @@ -1561,7 +1561,7 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, supported_time_grain_types: Optional[List[str]] = None, lock_aggregation_type: Optional[str] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, internal_metric_name: Optional[str] = None, **kwargs @@ -1643,12 +1643,12 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a managed hsm pool. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction @@ -1669,21 +1669,21 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["MHSMIPRule"]] = None, - virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.MHSMIPRule"]] = None, + virtual_network_rules: Optional[List["_models.MHSMVirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. @@ -1753,8 +1753,8 @@ class MHSMPrivateEndpointConnection(ManagedHsmResource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1784,12 +1784,12 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -1807,8 +1807,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -1822,18 +1822,24 @@ def __init__( class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str :ivar private_endpoint: Properties of the private endpoint object. :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1842,24 +1848,32 @@ class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str :keyword private_endpoint: Properties of the private endpoint object. :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpoint :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state @@ -1883,7 +1897,7 @@ class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateEndpointConnection"]] = None, + value: Optional[List["_models.MHSMPrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1953,7 +1967,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, required_zone_names: Optional[List[str]] = None, **kwargs @@ -1988,7 +2002,7 @@ class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateLinkResource"]] = None, + value: Optional[List["_models.MHSMPrivateLinkResource"]] = None, **kwargs ): """ @@ -2003,13 +2017,13 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ @@ -2023,20 +2037,20 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ @@ -2083,12 +2097,12 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction @@ -2109,21 +2123,21 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. @@ -2167,10 +2181,10 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -2257,7 +2271,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2298,10 +2312,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -2373,8 +2387,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -2403,9 +2417,9 @@ def __init__( self, *, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -2416,8 +2430,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -2440,8 +2454,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -2459,9 +2473,9 @@ def __init__( *, id: Optional[str] = None, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -2474,8 +2488,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionProvisioningState """ @@ -2504,7 +2518,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2594,7 +2608,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -2609,13 +2623,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ @@ -2629,20 +2643,20 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.ActionsRequired """ @@ -2669,7 +2683,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2702,8 +2716,8 @@ class RotationPolicy(msrest.serialization.Model): def __init__( self, *, - attributes: Optional["KeyRotationPolicyAttributes"] = None, - lifetime_actions: Optional[List["LifetimeAction"]] = None, + attributes: Optional["_models.KeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, **kwargs ): """ @@ -2761,7 +2775,7 @@ class Secret(Resource): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", **kwargs ): """ @@ -2844,7 +2858,7 @@ class SecretCreateOrUpdateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2876,7 +2890,7 @@ class SecretListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Secret"]] = None, + value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2909,7 +2923,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["SecretPatchProperties"] = None, + properties: Optional["_models.SecretPatchProperties"] = None, **kwargs ): """ @@ -2945,7 +2959,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -2999,7 +3013,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -3039,8 +3053,8 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -3061,10 +3075,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName """ @@ -3081,15 +3095,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -3102,15 +3116,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the key vault resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar created_by_type: The type of identity that created the key vault resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType :ivar created_at: The timestamp of the key vault resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the key vault resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). @@ -3130,25 +3144,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the key vault resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the key vault resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType :keyword created_at: The timestamp of the key vault resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the key vault resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.IdentityType :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). @@ -3243,7 +3257,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -3305,7 +3319,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -3343,7 +3357,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -3424,7 +3438,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3460,7 +3474,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3493,7 +3507,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -3541,7 +3555,7 @@ class VaultPatchProperties(msrest.serialization.Model): :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :vartype soft_delete_retention_in_days: int :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -3579,17 +3593,17 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, enable_rbac_authorization: Optional[bool] = None, soft_delete_retention_in_days: Optional[int] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, public_network_access: Optional[str] = None, **kwargs ): @@ -3626,7 +3640,7 @@ def __init__( <=90. :paramtype soft_delete_retention_in_days: int :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -3705,7 +3719,7 @@ class VaultProperties(msrest.serialization.Model): actions are always authorized with RBAC. :vartype enable_rbac_authorization: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -3716,8 +3730,8 @@ class VaultProperties(msrest.serialization.Model): :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. :vartype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the @@ -3762,8 +3776,8 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, @@ -3771,10 +3785,10 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_rbac_authorization: Optional[bool] = False, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, - provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, public_network_access: Optional[str] = "enabled", **kwargs ): @@ -3817,7 +3831,7 @@ def __init__( actions are always authorized with RBAC. :paramtype enable_rbac_authorization: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -3828,8 +3842,8 @@ def __init__( :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_06_01_preview.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultProvisioningState :keyword public_network_access: Property to specify whether the vault will accept traffic from diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py index 8e1d8528d945..49be258e3efc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/__init__.py @@ -16,6 +16,9 @@ from ._operations import Operations from ._secrets_operations import SecretsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -27,3 +30,5 @@ 'Operations', 'SecretsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py index 7d11eebc4e2b..7eb1ba547baa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_keys_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_if_not_exist_request( vault_name: str, key_name: str, *, - json: JSONType = None, + json: Optional[_models.KeyCreateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_if_not_exist_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -80,9 +81,12 @@ def build_get_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -95,18 +99,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -117,9 +119,12 @@ def build_list_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys") # pylint: disable=line-too-long path_format_arguments = { @@ -131,18 +136,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -155,9 +158,12 @@ def build_get_version_request( key_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_get_version_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_versions_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions") # pylint: disable=line-too-long path_format_arguments = { @@ -209,42 +216,38 @@ def build_list_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class KeysOperations(object): - """KeysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_if_not_exist( @@ -252,9 +255,9 @@ def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -273,14 +276,17 @@ def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -293,11 +299,13 @@ def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,7 +333,7 @@ def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -340,13 +348,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -356,11 +367,13 @@ def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -387,7 +400,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -401,13 +414,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -417,9 +433,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -429,9 +447,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -472,7 +492,7 @@ def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -489,13 +509,16 @@ def get_version( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -506,11 +529,13 @@ def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -538,7 +563,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -554,13 +579,16 @@ def list_versions( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -571,9 +599,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -584,9 +614,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py index 9ad041bfb40b..ecce7209b39c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -196,9 +200,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +216,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -233,9 +238,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") path_format_arguments = { @@ -245,20 +253,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -267,9 +273,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs") path_format_arguments = { @@ -279,18 +288,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -301,9 +308,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -315,18 +325,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -337,9 +345,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -351,58 +362,57 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedHsmsOperations(object): - """ManagedHsmsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -414,11 +424,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -448,9 +460,9 @@ def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -472,37 +484,47 @@ def begin_create_or_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -519,17 +541,20 @@ def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -541,11 +566,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -556,14 +583,17 @@ def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -575,9 +605,9 @@ def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -599,37 +629,47 @@ def begin_update( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -648,13 +688,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -663,11 +706,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -709,20 +754,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -732,8 +782,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -752,7 +808,7 @@ def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -764,13 +820,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -779,11 +838,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -813,7 +874,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -828,13 +889,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -844,9 +908,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -856,9 +922,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -897,7 +965,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -910,13 +978,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -925,9 +996,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -936,9 +1009,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -976,7 +1051,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedManagedHsmListResult"]: + ) -> Iterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -987,13 +1062,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1001,9 +1079,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1011,9 +1091,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1053,7 +1135,7 @@ def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -1065,13 +1147,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -1080,11 +1165,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1112,13 +1199,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1127,11 +1217,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1173,20 +1265,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1196,8 +1293,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py index 9a2429c8baff..6a9e46cadead 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_put_request( name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.MHSMPrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateEndpointConnectionsOperations(object): - """MHSMPrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -214,7 +216,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> Iterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -229,13 +231,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -331,11 +343,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -363,9 +377,9 @@ def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -382,14 +396,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -402,11 +419,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -437,14 +456,17 @@ def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -454,11 +476,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,7 +518,7 @@ def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> LROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -518,35 +542,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py index 358330789af5..392580d15a06 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_mhsm_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_mhsm_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_mhsm_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateLinkResourcesOperations(object): - """MHSMPrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_mhsm_resource( @@ -88,7 +88,7 @@ def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -100,13 +100,16 @@ def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -115,11 +118,13 @@ def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py index 72a5c5883e48..f44aa0f4efb0 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py index 921dc01774aa..b9619e75a858 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -120,9 +122,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -135,18 +140,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -157,9 +160,12 @@ def build_list_by_resource_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -215,7 +217,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -230,13 +232,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -246,11 +251,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -279,9 +286,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -298,14 +305,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -318,11 +328,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -353,14 +365,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -370,11 +385,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,7 +427,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -434,35 +451,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -481,7 +508,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -496,13 +523,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -512,9 +542,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -524,9 +556,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py index 4c74be4889b6..0e33e27942ae 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py index 6b30121bf7aa..dde2add8c876 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_secrets_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_or_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -79,14 +80,17 @@ def build_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -99,20 +103,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -126,9 +128,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -141,18 +146,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -165,9 +168,12 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") # pylint: disable=line-too-long path_format_arguments = { @@ -179,44 +185,40 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SecretsOperations(object): - """SecretsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_or_update( @@ -224,9 +226,9 @@ def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -245,14 +247,17 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -265,11 +270,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -300,9 +307,9 @@ def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -320,14 +327,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -340,11 +350,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -376,7 +388,7 @@ def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -391,13 +403,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -407,11 +422,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -439,7 +456,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.SecretListResult"]: + ) -> Iterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -456,13 +473,16 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -473,9 +493,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -486,9 +508,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py index a51f073e2c12..1d717cd20a35 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_06_01_preview/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -195,14 +199,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -215,20 +222,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -242,9 +247,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -255,20 +263,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -279,9 +285,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -291,20 +300,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -313,9 +320,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -325,18 +335,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -347,9 +355,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -361,18 +372,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -383,9 +392,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -397,18 +409,16 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -419,10 +429,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -432,21 +445,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -454,14 +465,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -471,62 +485,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_06_01_preview.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_06_01_preview.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -538,11 +551,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,9 +587,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -595,37 +610,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,9 +668,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -659,14 +684,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -678,11 +706,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,13 +755,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -740,11 +773,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -767,7 +802,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -779,13 +814,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -794,11 +832,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -825,9 +865,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -844,14 +884,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -864,11 +907,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -899,7 +944,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -913,13 +958,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -929,9 +977,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -941,9 +991,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -981,7 +1033,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -992,13 +1044,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1007,9 +1062,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1018,9 +1075,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1057,7 +1116,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1067,13 +1126,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1081,9 +1143,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1091,9 +1155,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1132,7 +1198,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1144,13 +1210,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1159,11 +1228,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1190,13 +1261,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1205,11 +1279,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1251,20 +1327,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-06-01-preview") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1274,8 +1355,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1293,7 +1380,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1311,14 +1398,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_06_01_preview.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1328,9 +1418,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1340,9 +1432,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1378,9 +1472,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1391,14 +1485,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_06_01_preview.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-06-01-preview") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01-preview")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1408,11 +1505,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/__init__.py index 59fd240c9528..d19915ab3650 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/__init__.py @@ -10,9 +10,14 @@ from ._version import VERSION __version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_key_vault_management_client.py index ece05ef6c236..6768b5ee29be 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_key_vault_management_client.py @@ -76,15 +76,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py index 9f8bb24bdd99..c1257f7f4e11 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "10.0.0" +VERSION = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/__init__.py index 8cff887e652d..1aa2a0b291a3 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/__init__.py @@ -7,9 +7,14 @@ # -------------------------------------------------------------------------- from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) -# `._patch.py` is used for handwritten extensions to the generated code -# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md -from ._patch import patch_sdk -patch_sdk() +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/_key_vault_management_client.py index 8b7d16248c0e..84e102d61063 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/_key_vault_management_client.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/_key_vault_management_client.py @@ -76,15 +76,33 @@ def __init__( self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) self._serialize.client_side_validation = False - self.keys = KeysOperations(self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_hsms = ManagedHsmsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) - self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.secrets = SecretsOperations(self._client, self._config, self._serialize, self._deserialize) + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/__init__.py index 8e1d8528d945..49be258e3efc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/__init__.py @@ -16,6 +16,9 @@ from ._operations import Operations from ._secrets_operations import SecretsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -27,3 +30,5 @@ 'Operations', 'SecretsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_keys_operations.py index 195f72b9cecc..97c2b450e0b7 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_keys_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class KeysOperations: - """KeysOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_if_not_exist( @@ -51,9 +50,9 @@ async def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -72,14 +71,17 @@ async def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -92,11 +94,13 @@ async def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -124,7 +128,7 @@ async def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -139,13 +143,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -155,11 +162,13 @@ async def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -186,7 +195,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -200,13 +209,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -216,9 +228,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -228,9 +242,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -271,7 +287,7 @@ async def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -288,13 +304,16 @@ async def get_version( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -305,11 +324,13 @@ async def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -337,7 +358,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> AsyncIterable["_models.KeyListResult"]: + ) -> AsyncIterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -353,13 +374,16 @@ def list_versions( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -370,9 +394,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -383,9 +409,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py index 61016e5701e6..10ff407939ea 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ManagedHsmsOperations: - """ManagedHsmsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -131,37 +135,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -178,17 +192,20 @@ async def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -200,11 +217,13 @@ async def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -215,14 +234,17 @@ async def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -234,9 +256,9 @@ async def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> AsyncLROPoller["_models.ManagedHsm"]: + ) -> AsyncLROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -258,37 +280,47 @@ async def begin_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -307,13 +339,16 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -322,11 +357,13 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -368,20 +405,25 @@ async def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -391,8 +433,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -411,7 +459,7 @@ async def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -423,13 +471,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -438,11 +489,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -472,7 +525,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -487,13 +540,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -503,9 +559,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -515,9 +573,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -556,7 +616,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ManagedHsmListResult"]: + ) -> AsyncIterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -569,13 +629,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -584,9 +647,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -595,9 +660,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -635,7 +702,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedManagedHsmListResult"]: + ) -> AsyncIterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -646,13 +713,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -660,9 +730,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -670,9 +742,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -712,7 +786,7 @@ async def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -724,13 +798,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -739,11 +816,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -771,13 +850,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -786,11 +868,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -832,20 +916,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -855,8 +944,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py index 74cba613eddb..9531607d0ee2 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateEndpointConnectionsOperations: - """MHSMPrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -53,7 +52,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> AsyncIterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> AsyncIterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -68,13 +67,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -84,9 +86,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -96,9 +100,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -139,7 +145,7 @@ async def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -154,13 +160,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -170,11 +179,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,9 +213,9 @@ async def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -221,14 +232,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -241,11 +255,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -276,14 +292,17 @@ async def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -293,11 +312,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -333,7 +354,7 @@ async def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -357,35 +378,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_link_resources_operations.py index e9a1bf957082..b7a9de380631 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_mhsm_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class MHSMPrivateLinkResourcesOperations: - """MHSMPrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_mhsm_resource( @@ -49,7 +48,7 @@ async def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -61,13 +60,16 @@ async def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -76,11 +78,13 @@ async def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_operations.py index 08a1a5e4762c..126b1620838a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_operations.py @@ -14,6 +14,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -23,32 +24,30 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -57,31 +56,38 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py index 80f1e974557a..7661a462d8ff 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,26 +27,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateEndpointConnectionsOperations: - """PrivateEndpointConnectionsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def get( @@ -54,7 +53,7 @@ async def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -69,13 +68,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -85,11 +87,13 @@ async def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -118,9 +122,9 @@ async def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -137,14 +141,17 @@ async def put( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -157,11 +164,13 @@ async def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -192,14 +201,17 @@ async def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -209,11 +221,13 @@ async def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -249,7 +263,7 @@ async def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]: + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -273,35 +287,45 @@ async def begin_delete( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -320,7 +344,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> AsyncIterable["_models.PrivateEndpointConnectionListResult"]: + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -335,13 +359,16 @@ def list_by_resource( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -351,9 +378,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -363,9 +392,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_link_resources_operations.py index e0199a35dd85..179a0030416e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_private_link_resources_operations.py @@ -13,6 +13,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -22,26 +23,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class PrivateLinkResourcesOperations: - """PrivateLinkResourcesOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def list_by_vault( @@ -49,7 +48,7 @@ async def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -61,13 +60,16 @@ async def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -76,11 +78,13 @@ async def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py index 233885a066b1..d5998705c07b 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_secrets_operations.py @@ -15,6 +15,7 @@ from azure.core.rest import 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 ... import models as _models @@ -24,26 +25,24 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class SecretsOperations: - """SecretsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace_async async def create_or_update( @@ -51,9 +50,9 @@ async def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -71,14 +70,17 @@ async def create_or_update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -91,11 +93,13 @@ async def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -126,9 +130,9 @@ async def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -146,14 +150,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -166,11 +173,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -202,7 +211,7 @@ async def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -217,13 +226,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -233,11 +245,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -265,7 +279,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.SecretListResult"]: + ) -> AsyncIterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -282,13 +296,16 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -299,9 +316,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -312,9 +331,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py index fa1266ae6942..31703cfbf05c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/aio/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -16,6 +16,7 @@ from azure.core.rest import 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 @@ -26,42 +27,43 @@ ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class VaultsOperations: - """VaultsOperations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + async def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -73,11 +75,13 @@ async def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -107,9 +111,9 @@ async def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Vault"]: + ) -> AsyncLROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -130,37 +134,47 @@ async def begin_create_or_update( :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2021_10_01.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -178,9 +192,9 @@ async def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -194,14 +208,17 @@ async def update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -213,11 +230,13 @@ async def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -260,13 +279,16 @@ async def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -275,11 +297,13 @@ async def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -302,7 +326,7 @@ async def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -314,13 +338,16 @@ async def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -329,11 +356,13 @@ async def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -360,9 +389,9 @@ async def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -378,14 +407,17 @@ async def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -398,11 +430,13 @@ async def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -433,7 +467,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -447,13 +481,16 @@ def list_by_resource_group( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -463,9 +500,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -475,9 +514,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -515,7 +556,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.VaultListResult"]: + ) -> AsyncIterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -526,13 +567,16 @@ def list_by_subscription( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -541,9 +585,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -552,9 +598,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -591,7 +639,7 @@ async def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> AsyncIterable["_models.DeletedVaultListResult"]: + ) -> AsyncIterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -601,13 +649,16 @@ def list_deleted( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -615,9 +666,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -625,9 +678,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -666,7 +721,7 @@ async def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -678,13 +733,16 @@ async def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -693,11 +751,13 @@ async def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -724,13 +784,16 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -739,11 +802,13 @@ async def _purge_deleted_initial( # pylint: disable=inconsistent-return-stateme subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -785,20 +850,25 @@ async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._purge_deleted_initial( + raw_result = await self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -808,8 +878,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -827,7 +903,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.ResourceListResult"]: + ) -> AsyncIterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -845,14 +921,17 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -862,9 +941,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -874,9 +955,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -912,9 +995,9 @@ async def get_next(next_link=None): @distributed_trace_async async def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -924,14 +1007,17 @@ async def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -941,11 +1027,13 @@ async def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/__init__.py index 125d8149779f..f0b287a64ffa 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/__init__.py @@ -104,7 +104,9 @@ StoragePermissions, VaultProvisioningState, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'AccessPolicyEntry', 'Attributes', @@ -201,3 +203,5 @@ 'StoragePermissions', 'VaultProvisioningState', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_key_vault_management_client_enums.py index a7e21aaa3c92..2cee448ee123 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_key_vault_management_client_enums.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_key_vault_management_client_enums.py @@ -7,23 +7,22 @@ # -------------------------------------------------------------------------- from enum import Enum -from six import with_metaclass from azure.core import CaseInsensitiveEnumMeta -class AccessPolicyUpdateKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): ADD = "add" REPLACE = "replace" REMOVE = "remove" -class ActionsRequired(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): """A message indicating if changes on the service provider require any updates on the consumer. """ NONE = "None" -class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -43,14 +42,14 @@ class CertificatePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)) BACKUP = "backup" RESTORE = "restore" -class CreateMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The vault's create mode to indicate whether the vault need to be recovered or not. """ RECOVER = "recover" DEFAULT = "default" -class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; otherwise, only the system can purge the object at the end of the retention interval. @@ -61,7 +60,7 @@ class DeletionRecoveryLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVERABLE = "Recoverable" RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" -class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of identity. """ @@ -70,7 +69,7 @@ class IdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The elliptic curve name. For valid values, see JsonWebKeyCurveName. """ @@ -79,7 +78,7 @@ class JsonWebKeyCurveName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): P521 = "P-521" P256_K = "P-256K" -class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The permitted JSON web key operations of the key. For more information, see JsonWebKeyOperation. """ @@ -92,7 +91,7 @@ class JsonWebKeyOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): UNWRAP_KEY = "unwrapKey" IMPORT_ENUM = "import" -class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the key. For valid values, see JsonWebKeyType. """ @@ -101,7 +100,7 @@ class JsonWebKeyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RSA = "RSA" RSA_HSM = "RSA-HSM" -class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" ENCRYPT = "encrypt" @@ -121,20 +120,20 @@ class KeyPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class ManagedHsmSkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU Family of the managed HSM Pool """ B = "B" -class ManagedHsmSkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ManagedHsmSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU of the managed HSM Pool """ STANDARD_B1 = "Standard_B1" CUSTOM_B32 = "Custom_B32" -class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. """ @@ -142,7 +141,7 @@ class NetworkRuleAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" DENY = "Deny" -class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not specified the default is 'AzureServices'. """ @@ -150,7 +149,7 @@ class NetworkRuleBypassOptions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum AZURE_SERVICES = "AzureServices" NONE = "None" -class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current provisioning state. """ @@ -161,7 +160,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveE FAILED = "Failed" DISCONNECTED = "Disconnected" -class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The private endpoint connection status. """ @@ -170,7 +169,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumM REJECTED = "Rejected" DISCONNECTED = "Disconnected" -class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state. """ @@ -191,7 +190,7 @@ class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: The managed HSM pool is being restored from full HSM backup. RESTORING = "Restoring" -class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Control permission for data plane traffic coming from public networks while private endpoint is enabled. """ @@ -199,7 +198,7 @@ class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reason that a vault name could not be used. The Reason element is only returned if NameAvailable is false. """ @@ -207,7 +206,7 @@ class Reason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): ACCOUNT_NAME_INVALID = "AccountNameInvalid" ALREADY_EXISTS = "AlreadyExists" -class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -219,20 +218,20 @@ class SecretPermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): RECOVER = "recover" PURGE = "purge" -class SkuFamily(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU family name """ A = "A" -class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """SKU name to specify whether the key vault is a standard vault or a premium vault. """ STANDARD = "standard" PREMIUM = "premium" -class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): ALL = "all" GET = "get" @@ -250,7 +249,7 @@ class StoragePermissions(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): GETSAS = "getsas" DELETESAS = "deletesas" -class VaultProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Provisioning state of the vault. """ diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_models_py3.py index c8bc534067ed..a4f8f39b767c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_models_py3.py @@ -7,12 +7,14 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._key_vault_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class AccessPolicyEntry(msrest.serialization.Model): @@ -51,7 +53,7 @@ def __init__( *, tenant_id: str, object_id: str, - permissions: "Permissions", + permissions: "_models.Permissions", application_id: Optional[str] = None, **kwargs ): @@ -140,8 +142,7 @@ class CheckNameAvailabilityResult(msrest.serialization.Model): and cannot be used. :vartype name_available: bool :ivar reason: The reason that a vault name could not be used. The Reason element is only - returned if NameAvailable is false. Possible values include: "AccountNameInvalid", - "AlreadyExists". + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". :vartype reason: str or ~azure.mgmt.keyvault.v2021_10_01.models.Reason :ivar message: An error message explaining the Reason value in more detail. :vartype message: str @@ -236,7 +237,7 @@ class DeletedManagedHsm(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedManagedHsmProperties"] = None, + properties: Optional["_models.DeletedManagedHsmProperties"] = None, **kwargs ): """ @@ -267,7 +268,7 @@ class DeletedManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedManagedHsm"]] = None, + value: Optional[List["_models.DeletedManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -365,7 +366,7 @@ class DeletedVault(msrest.serialization.Model): def __init__( self, *, - properties: Optional["DeletedVaultProperties"] = None, + properties: Optional["_models.DeletedVaultProperties"] = None, **kwargs ): """ @@ -396,7 +397,7 @@ class DeletedVaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["DeletedVault"]] = None, + value: Optional[List["_models.DeletedVault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -638,15 +639,15 @@ class Key(Resource): :vartype tags: dict[str, str] :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2021_10_01.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -682,25 +683,25 @@ class Key(Resource): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2021_10_01.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyCurveName """ super(Key, self).__init__(**kwargs) @@ -730,8 +731,8 @@ class KeyAttributes(msrest.serialization.Model): :vartype updated: long :ivar recovery_level: The deletion recovery level currently in effect for the object. If it contains 'Purgeable', then the object can be permanently deleted by a privileged user; - otherwise, only the system can purge the object at the end of the retention interval. Possible - values include: "Purgeable", "Recoverable+Purgeable", "Recoverable", + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", "Recoverable+ProtectedSubscription". :vartype recovery_level: str or ~azure.mgmt.keyvault.v2021_10_01.models.DeletionRecoveryLevel :ivar exportable: Indicates if the private key can be exported. @@ -806,7 +807,7 @@ class KeyCreateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "KeyProperties", + properties: "_models.KeyProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -838,7 +839,7 @@ class KeyListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Key"]] = None, + value: Optional[List["_models.Key"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -860,15 +861,15 @@ class KeyProperties(msrest.serialization.Model): :ivar attributes: The attributes of the key. :vartype attributes: ~azure.mgmt.keyvault.v2021_10_01.models.KeyAttributes - :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Possible values include: - "EC", "EC-HSM", "RSA", "RSA-HSM". + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". :vartype kty: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyType :ivar key_ops: :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyOperation] :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :vartype key_size: int - :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Possible - values include: "P-256", "P-384", "P-521", "P-256K". + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :vartype curve_name: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyCurveName :ivar key_uri: The URI to retrieve the current version of the key. :vartype key_uri: str @@ -894,25 +895,25 @@ class KeyProperties(msrest.serialization.Model): def __init__( self, *, - attributes: Optional["KeyAttributes"] = None, - kty: Optional[Union[str, "JsonWebKeyType"]] = None, - key_ops: Optional[List[Union[str, "JsonWebKeyOperation"]]] = None, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, key_size: Optional[int] = None, - curve_name: Optional[Union[str, "JsonWebKeyCurveName"]] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, **kwargs ): """ :keyword attributes: The attributes of the key. :paramtype attributes: ~azure.mgmt.keyvault.v2021_10_01.models.KeyAttributes - :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Possible values - include: "EC", "EC-HSM", "RSA", "RSA-HSM". + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". :paramtype kty: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyType :keyword key_ops: :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyOperation] :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. :paramtype key_size: int - :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. - Possible values include: "P-256", "P-384", "P-521", "P-256K". + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". :paramtype curve_name: str or ~azure.mgmt.keyvault.v2021_10_01.models.JsonWebKeyCurveName """ super(KeyProperties, self).__init__(**kwargs) @@ -1007,7 +1008,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -1075,9 +1076,9 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, - properties: Optional["ManagedHsmProperties"] = None, + properties: Optional["_models.ManagedHsmProperties"] = None, **kwargs ): """ @@ -1138,7 +1139,7 @@ class ManagedHsmListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ManagedHsm"]] = None, + value: Optional[List["_models.ManagedHsm"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1180,13 +1181,12 @@ class ManagedHsmProperties(msrest.serialization.Model): this functionality is irreversible. :vartype enable_purge_protection: bool :ivar create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :ivar status_message: Resource Status Message. :vartype status_message: str - :ivar provisioning_state: Provisioning state. Possible values include: "Succeeded", - "Provisioning", "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", - "Restoring". + :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Provisioning", + "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", "Restoring". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.ProvisioningState :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. @@ -1196,7 +1196,7 @@ class ManagedHsmProperties(msrest.serialization.Model): :vartype private_endpoint_connections: list[~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnectionItem] :ivar public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :vartype public_network_access: str or ~azure.mgmt.keyvault.v2021_10_01.models.PublicNetworkAccess :ivar scheduled_purge_date: The scheduled purge date in UTC. @@ -1235,9 +1235,9 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_purge_protection: Optional[bool] = True, - create_mode: Optional[Union[str, "CreateMode"]] = None, - network_acls: Optional["MHSMNetworkRuleSet"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, **kwargs ): """ @@ -1262,13 +1262,13 @@ def __init__( Enabling this functionality is irreversible. :paramtype enable_purge_protection: bool :keyword create_mode: The create mode to indicate whether the resource is being created or is - being recovered from a deleted resource. Possible values include: "recover", "default". + being recovered from a deleted resource. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMNetworkRuleSet :keyword public_network_access: Control permission for data plane traffic coming from public - networks while private endpoint is enabled. Possible values include: "Enabled", "Disabled". + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". :paramtype public_network_access: str or ~azure.mgmt.keyvault.v2021_10_01.models.PublicNetworkAccess """ @@ -1293,9 +1293,9 @@ class ManagedHsmSku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :ivar family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :vartype family: str or ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmSkuFamily - :ivar name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :ivar name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :vartype name: str or ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmSkuName """ @@ -1313,14 +1313,14 @@ class ManagedHsmSku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "ManagedHsmSkuFamily"] = "B", - name: Union[str, "ManagedHsmSkuName"], + family: Union[str, "_models.ManagedHsmSkuFamily"] = "B", + name: Union[str, "_models.ManagedHsmSkuName"], **kwargs ): """ - :keyword family: Required. SKU Family of the managed HSM Pool. Possible values include: "B". + :keyword family: Required. SKU Family of the managed HSM Pool. Known values are: "B". :paramtype family: str or ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmSkuFamily - :keyword name: Required. SKU of the managed HSM Pool. Possible values include: "Standard_B1", + :keyword name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", "Custom_B32". :paramtype name: str or ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmSkuName """ @@ -1382,7 +1382,7 @@ def __init__( supported_aggregation_types: Optional[List[str]] = None, supported_time_grain_types: Optional[List[str]] = None, lock_aggregation_type: Optional[str] = None, - dimensions: Optional[List["DimensionProperties"]] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, fill_gap_with_zero: Optional[bool] = None, internal_metric_name: Optional[str] = None, **kwargs @@ -1463,11 +1463,11 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a managed hsm pool. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleAction :ivar ip_rules: The list of IP address rules. @@ -1487,20 +1487,20 @@ class MHSMNetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["MHSMIPRule"]] = None, - virtual_network_rules: Optional[List["MHSMVirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.MHSMIPRule"]] = None, + virtual_network_rules: Optional[List["_models.MHSMVirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_10_01.models.MHSMIPRule] @@ -1569,8 +1569,8 @@ class MHSMPrivateEndpointConnection(ManagedHsmResource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -1600,12 +1600,12 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, etag: Optional[str] = None, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -1622,8 +1622,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -1637,18 +1637,24 @@ def __init__( class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): """Private endpoint connection item. + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str :ivar private_endpoint: Properties of the private endpoint object. :vartype private_endpoint: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpoint :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, @@ -1657,23 +1663,31 @@ class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): def __init__( self, *, - private_endpoint: Optional["MHSMPrivateEndpoint"] = None, - private_link_service_connection_state: Optional["MHSMPrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str :keyword private_endpoint: Properties of the private endpoint object. :paramtype private_endpoint: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpoint :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state self.provisioning_state = provisioning_state @@ -1696,7 +1710,7 @@ class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateEndpointConnection"]] = None, + value: Optional[List["_models.MHSMPrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -1765,7 +1779,7 @@ def __init__( self, *, location: Optional[str] = None, - sku: Optional["ManagedHsmSku"] = None, + sku: Optional["_models.ManagedHsmSku"] = None, tags: Optional[Dict[str, str]] = None, required_zone_names: Optional[List[str]] = None, **kwargs @@ -1800,7 +1814,7 @@ class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["MHSMPrivateLinkResource"]] = None, + value: Optional[List["_models.MHSMPrivateLinkResource"]] = None, **kwargs ): """ @@ -1815,13 +1829,13 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_10_01.models.ActionsRequired """ @@ -1834,20 +1848,20 @@ class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_10_01.models.ActionsRequired """ super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) @@ -1893,11 +1907,11 @@ class NetworkRuleSet(msrest.serialization.Model): """A set of rules governing the network accessibility of a vault. :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :vartype bypass: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleBypassOptions :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules - match. This is only used after the bypass property has been evaluated. Possible values include: + match. This is only used after the bypass property has been evaluated. Known values are: "Allow", "Deny". :vartype default_action: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleAction :ivar ip_rules: The list of IP address rules. @@ -1917,20 +1931,20 @@ class NetworkRuleSet(msrest.serialization.Model): def __init__( self, *, - bypass: Optional[Union[str, "NetworkRuleBypassOptions"]] = None, - default_action: Optional[Union[str, "NetworkRuleAction"]] = None, - ip_rules: Optional[List["IPRule"]] = None, - virtual_network_rules: Optional[List["VirtualNetworkRule"]] = None, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, **kwargs ): """ :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or - 'None'. If not specified the default is 'AzureServices'. Possible values include: - "AzureServices", "None". + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". :paramtype bypass: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleBypassOptions :keyword default_action: The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. - Possible values include: "Allow", "Deny". + Known values are: "Allow", "Deny". :paramtype default_action: str or ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleAction :keyword ip_rules: The list of IP address rules. :paramtype ip_rules: list[~azure.mgmt.keyvault.v2021_10_01.models.IPRule] @@ -1972,10 +1986,10 @@ def __init__( self, *, name: Optional[str] = None, - display: Optional["OperationDisplay"] = None, + display: Optional["_models.OperationDisplay"] = None, origin: Optional[str] = None, is_data_action: Optional[bool] = None, - service_specification: Optional["ServiceSpecification"] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs ): """ @@ -2061,7 +2075,7 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Operation"]] = None, + value: Optional[List["_models.Operation"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2100,10 +2114,10 @@ class Permissions(msrest.serialization.Model): def __init__( self, *, - keys: Optional[List[Union[str, "KeyPermissions"]]] = None, - secrets: Optional[List[Union[str, "SecretPermissions"]]] = None, - certificates: Optional[List[Union[str, "CertificatePermissions"]]] = None, - storage: Optional[List[Union[str, "StoragePermissions"]]] = None, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, **kwargs ): """ @@ -2173,8 +2187,8 @@ class PrivateEndpointConnection(Resource): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -2203,9 +2217,9 @@ def __init__( self, *, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -2216,8 +2230,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -2240,8 +2254,8 @@ class PrivateEndpointConnectionItem(msrest.serialization.Model): :ivar private_link_service_connection_state: Approval state of the private link connection. :vartype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -2259,9 +2273,9 @@ def __init__( *, id: Optional[str] = None, etag: Optional[str] = None, - private_endpoint: Optional["PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, - provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): """ @@ -2274,8 +2288,8 @@ def __init__( :keyword private_link_service_connection_state: Approval state of the private link connection. :paramtype private_link_service_connection_state: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkServiceConnectionState - :keyword provisioning_state: Provisioning state of the private endpoint connection. Possible - values include: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionProvisioningState """ @@ -2304,7 +2318,7 @@ class PrivateEndpointConnectionListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateEndpointConnection"]] = None, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2393,7 +2407,7 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["PrivateLinkResource"]] = None, + value: Optional[List["_models.PrivateLinkResource"]] = None, **kwargs ): """ @@ -2408,13 +2422,13 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): """An object that represents the approval state of the private link connection. :ivar status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :vartype status: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointServiceConnectionStatus :ivar description: The reason for approval or rejection. :vartype description: str :ivar actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :vartype actions_required: str or ~azure.mgmt.keyvault.v2021_10_01.models.ActionsRequired """ @@ -2427,20 +2441,20 @@ class PrivateLinkServiceConnectionState(msrest.serialization.Model): def __init__( self, *, - status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, description: Optional[str] = None, - actions_required: Optional[Union[str, "ActionsRequired"]] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, **kwargs ): """ :keyword status: Indicates whether the connection has been approved, rejected or removed by the - key vault owner. Possible values include: "Pending", "Approved", "Rejected", "Disconnected". + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". :paramtype status: str or ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointServiceConnectionStatus :keyword description: The reason for approval or rejection. :paramtype description: str :keyword actions_required: A message indicating if changes on the service provider require any - updates on the consumer. Possible values include: "None". + updates on the consumer. Known values are: "None". :paramtype actions_required: str or ~azure.mgmt.keyvault.v2021_10_01.models.ActionsRequired """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) @@ -2466,7 +2480,7 @@ class ResourceListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Resource"]] = None, + value: Optional[List["_models.Resource"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2523,7 +2537,7 @@ class Secret(Resource): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", **kwargs ): """ @@ -2606,7 +2620,7 @@ class SecretCreateOrUpdateParameters(msrest.serialization.Model): def __init__( self, *, - properties: "SecretProperties", + properties: "_models.SecretProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -2638,7 +2652,7 @@ class SecretListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Secret"]] = None, + value: Optional[List["_models.Secret"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -2671,7 +2685,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["SecretPatchProperties"] = None, + properties: Optional["_models.SecretPatchProperties"] = None, **kwargs ): """ @@ -2707,7 +2721,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -2761,7 +2775,7 @@ def __init__( *, value: Optional[str] = None, content_type: Optional[str] = None, - attributes: Optional["SecretAttributes"] = None, + attributes: Optional["_models.SecretAttributes"] = None, **kwargs ): """ @@ -2800,8 +2814,8 @@ class ServiceSpecification(msrest.serialization.Model): def __init__( self, *, - log_specifications: Optional[List["LogSpecification"]] = None, - metric_specifications: Optional[List["MetricSpecification"]] = None, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, **kwargs ): """ @@ -2821,10 +2835,10 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :ivar family: Required. SKU family name. Possible values include: "A". + :ivar family: Required. SKU family name. Known values are: "A". :vartype family: str or ~azure.mgmt.keyvault.v2021_10_01.models.SkuFamily :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :vartype name: str or ~azure.mgmt.keyvault.v2021_10_01.models.SkuName """ @@ -2841,15 +2855,15 @@ class Sku(msrest.serialization.Model): def __init__( self, *, - family: Union[str, "SkuFamily"] = "A", - name: Union[str, "SkuName"], + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], **kwargs ): """ - :keyword family: Required. SKU family name. Possible values include: "A". + :keyword family: Required. SKU family name. Known values are: "A". :paramtype family: str or ~azure.mgmt.keyvault.v2021_10_01.models.SkuFamily :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a - premium vault. Possible values include: "standard", "premium". + premium vault. Known values are: "standard", "premium". :paramtype name: str or ~azure.mgmt.keyvault.v2021_10_01.models.SkuName """ super(Sku, self).__init__(**kwargs) @@ -2862,15 +2876,15 @@ class SystemData(msrest.serialization.Model): :ivar created_by: The identity that created the key vault resource. :vartype created_by: str - :ivar created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :ivar created_by_type: The type of identity that created the key vault resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". :vartype created_by_type: str or ~azure.mgmt.keyvault.v2021_10_01.models.IdentityType :ivar created_at: The timestamp of the key vault resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the key vault resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_10_01.models.IdentityType :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime @@ -2889,25 +2903,25 @@ def __init__( self, *, created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "IdentityType"]] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, created_at: Optional[datetime.datetime] = None, last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "IdentityType"]] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, last_modified_at: Optional[datetime.datetime] = None, **kwargs ): """ :keyword created_by: The identity that created the key vault resource. :paramtype created_by: str - :keyword created_by_type: The type of identity that created the key vault resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". + :keyword created_by_type: The type of identity that created the key vault resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2021_10_01.models.IdentityType :keyword created_at: The timestamp of the key vault resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the key vault resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the key vault resource. - Possible values include: "User", "Application", "ManagedIdentity", "Key". + Known values are: "User", "Application", "ManagedIdentity", "Key". :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.v2021_10_01.models.IdentityType :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime @@ -2965,7 +2979,7 @@ class Vault(msrest.serialization.Model): def __init__( self, *, - properties: "VaultProperties", + properties: "_models.VaultProperties", location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs @@ -3026,7 +3040,7 @@ class VaultAccessPolicyParameters(msrest.serialization.Model): def __init__( self, *, - properties: "VaultAccessPolicyProperties", + properties: "_models.VaultAccessPolicyProperties", **kwargs ): """ @@ -3062,7 +3076,7 @@ class VaultAccessPolicyProperties(msrest.serialization.Model): def __init__( self, *, - access_policies: List["AccessPolicyEntry"], + access_policies: List["_models.AccessPolicyEntry"], **kwargs ): """ @@ -3142,7 +3156,7 @@ def __init__( self, *, location: str, - properties: "VaultProperties", + properties: "_models.VaultProperties", tags: Optional[Dict[str, str]] = None, **kwargs ): @@ -3178,7 +3192,7 @@ class VaultListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Vault"]] = None, + value: Optional[List["_models.Vault"]] = None, next_link: Optional[str] = None, **kwargs ): @@ -3211,7 +3225,7 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - properties: Optional["VaultPatchProperties"] = None, + properties: Optional["_models.VaultPatchProperties"] = None, **kwargs ): """ @@ -3258,7 +3272,7 @@ class VaultPatchProperties(msrest.serialization.Model): :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. :vartype soft_delete_retention_in_days: int :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -3296,17 +3310,17 @@ def __init__( self, *, tenant_id: Optional[str] = None, - sku: Optional["Sku"] = None, - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, enabled_for_template_deployment: Optional[bool] = None, enable_soft_delete: Optional[bool] = None, enable_rbac_authorization: Optional[bool] = None, soft_delete_retention_in_days: Optional[int] = None, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, public_network_access: Optional[str] = None, **kwargs ): @@ -3342,7 +3356,7 @@ def __init__( <=90. :paramtype soft_delete_retention_in_days: int :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -3419,7 +3433,7 @@ class VaultProperties(msrest.serialization.Model): the default value of false. Note that management actions are always authorized with RBAC. :vartype enable_rbac_authorization: bool :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered - or not. Possible values include: "recover", "default". + or not. Known values are: "recover", "default". :vartype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :ivar enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for this vault @@ -3430,8 +3444,8 @@ class VaultProperties(msrest.serialization.Model): :ivar network_acls: Rules governing the accessibility of the key vault from specific network locations. :vartype network_acls: ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleSet - :ivar provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.VaultProvisioningState :ivar private_endpoint_connections: List of private endpoint connections associated with the @@ -3476,8 +3490,8 @@ def __init__( self, *, tenant_id: str, - sku: "Sku", - access_policies: Optional[List["AccessPolicyEntry"]] = None, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, vault_uri: Optional[str] = None, enabled_for_deployment: Optional[bool] = None, enabled_for_disk_encryption: Optional[bool] = None, @@ -3485,10 +3499,10 @@ def __init__( enable_soft_delete: Optional[bool] = True, soft_delete_retention_in_days: Optional[int] = 90, enable_rbac_authorization: Optional[bool] = False, - create_mode: Optional[Union[str, "CreateMode"]] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, enable_purge_protection: Optional[bool] = None, - network_acls: Optional["NetworkRuleSet"] = None, - provisioning_state: Optional[Union[str, "VaultProvisioningState"]] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, public_network_access: Optional[str] = "enabled", **kwargs ): @@ -3529,7 +3543,7 @@ def __init__( the default value of false. Note that management actions are always authorized with RBAC. :paramtype enable_rbac_authorization: bool :keyword create_mode: The vault's create mode to indicate whether the vault need to be - recovered or not. Possible values include: "recover", "default". + recovered or not. Known values are: "recover", "default". :paramtype create_mode: str or ~azure.mgmt.keyvault.v2021_10_01.models.CreateMode :keyword enable_purge_protection: Property specifying whether protection against purge is enabled for this vault. Setting this property to true activates protection against purge for @@ -3540,8 +3554,8 @@ def __init__( :keyword network_acls: Rules governing the accessibility of the key vault from specific network locations. :paramtype network_acls: ~azure.mgmt.keyvault.v2021_10_01.models.NetworkRuleSet - :keyword provisioning_state: Provisioning state of the vault. Possible values include: - "Succeeded", "RegisteringDns". + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". :paramtype provisioning_state: str or ~azure.mgmt.keyvault.v2021_10_01.models.VaultProvisioningState :keyword public_network_access: Property to specify whether the vault will accept traffic from diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/__init__.py index 8e1d8528d945..49be258e3efc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/__init__.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/__init__.py @@ -16,6 +16,9 @@ from ._operations import Operations from ._secrets_operations import SecretsOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'KeysOperations', 'VaultsOperations', @@ -27,3 +30,5 @@ 'Operations', 'SecretsOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_keys_operations.py index c8dde657e705..56b4aad1b518 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_keys_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_keys_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_if_not_exist_request( vault_name: str, key_name: str, *, - json: JSONType = None, + json: Optional[_models.KeyCreateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_if_not_exist_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -80,9 +81,12 @@ def build_get_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # pylint: disable=line-too-long path_format_arguments = { @@ -95,18 +99,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -117,9 +119,12 @@ def build_list_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys") # pylint: disable=line-too-long path_format_arguments = { @@ -131,18 +136,16 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -155,9 +158,12 @@ def build_get_version_request( key_version: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,18 +177,16 @@ def build_get_version_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -194,9 +198,12 @@ def build_list_versions_request( key_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions") # pylint: disable=line-too-long path_format_arguments = { @@ -209,42 +216,38 @@ def build_list_versions_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class KeysOperations(object): - """KeysOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`keys` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_if_not_exist( @@ -252,9 +255,9 @@ def create_if_not_exist( resource_group_name: str, vault_name: str, key_name: str, - parameters: "_models.KeyCreateParameters", + parameters: _models.KeyCreateParameters, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write operations being performed. This API does not create subsequent versions, and does not update existing keys. @@ -273,14 +276,17 @@ def create_if_not_exist( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] _json = self._serialize.body(parameters, 'KeyCreateParameters') @@ -293,11 +299,13 @@ def create_if_not_exist( content_type=content_type, json=_json, template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -325,7 +333,7 @@ def get( vault_name: str, key_name: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the current version of the specified key from the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -340,13 +348,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_request( @@ -356,11 +367,13 @@ def get( key_name=key_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -387,7 +400,7 @@ def list( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the keys in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -400,13 +413,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -416,9 +432,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -428,9 +446,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -471,7 +491,7 @@ def get_version( key_name: str, key_version: str, **kwargs: Any - ) -> "_models.Key": + ) -> _models.Key: """Gets the specified version of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -488,13 +508,16 @@ def get_version( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Key :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Key"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] request = build_get_version_request( @@ -505,11 +528,13 @@ def get_version( key_version=key_version, api_version=api_version, template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -537,7 +562,7 @@ def list_versions( vault_name: str, key_name: str, **kwargs: Any - ) -> Iterable["_models.KeyListResult"]: + ) -> Iterable[_models.KeyListResult]: """Lists the versions of the specified key in the specified key vault. :param resource_group_name: The name of the resource group which contains the specified key @@ -552,13 +577,16 @@ def list_versions( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.KeyListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.KeyListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -569,9 +597,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -582,9 +612,11 @@ def prepare_request(next_link=None): key_name=key_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py index 1d406740fc8f..575428dd5d13 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_managed_hsms_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request_initial( name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.ManagedHsm] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -196,9 +200,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") # pylint: disable=line-too-long path_format_arguments = { @@ -209,20 +216,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -233,9 +238,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") path_format_arguments = { @@ -245,20 +253,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -267,9 +273,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs") path_format_arguments = { @@ -279,18 +288,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -301,9 +308,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}") # pylint: disable=line-too-long path_format_arguments = { @@ -315,18 +325,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -337,9 +345,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -351,58 +362,57 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class ManagedHsmsOperations(object): - """ManagedHsmsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -414,11 +424,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -448,9 +460,9 @@ def begin_create_or_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Create or update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -471,37 +483,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -518,17 +540,20 @@ def _update_initial( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> "_models.ManagedHsm": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] + ) -> _models.ManagedHsm: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] _json = self._serialize.body(parameters, 'ManagedHsm') @@ -540,11 +565,13 @@ def _update_initial( content_type=content_type, json=_json, template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -555,14 +582,17 @@ def _update_initial( 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 == 200: deserialized = self._deserialize('ManagedHsm', pipeline_response) if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, response_headers) return deserialized @@ -574,9 +604,9 @@ def begin_update( self, resource_group_name: str, name: str, - parameters: "_models.ManagedHsm", + parameters: _models.ManagedHsm, **kwargs: Any - ) -> LROPoller["_models.ManagedHsm"]: + ) -> LROPoller[_models.ManagedHsm]: """Update a managed HSM Pool in the specified subscription. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -597,37 +627,47 @@ def begin_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsm"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, name=name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('ManagedHsm', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -646,13 +686,16 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request_initial( @@ -661,11 +704,13 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -707,20 +752,25 @@ def begin_delete( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -730,8 +780,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -750,7 +806,7 @@ def get( resource_group_name: str, name: str, **kwargs: Any - ) -> Optional["_models.ManagedHsm"]: + ) -> Optional[_models.ManagedHsm]: """Gets the specified managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -762,13 +818,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsm or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.ManagedHsm"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] request = build_get_request( @@ -777,11 +836,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -811,7 +872,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription and within the specified resource group. @@ -826,13 +887,16 @@ def list_by_resource_group( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -842,9 +906,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -854,9 +920,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -895,7 +963,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ManagedHsmListResult"]: + ) -> Iterable[_models.ManagedHsmListResult]: """The List operation gets information about the managed HSM Pools associated with the subscription. @@ -908,13 +976,16 @@ def list_by_subscription( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -923,9 +994,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -934,9 +1007,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -974,7 +1049,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedManagedHsmListResult"]: + ) -> Iterable[_models.DeletedManagedHsmListResult]: """The List operation gets information about the deleted managed HSMs associated with the subscription. @@ -985,13 +1060,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.DeletedManagedHsmListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsmListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -999,9 +1077,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1009,9 +1089,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1051,7 +1133,7 @@ def get_deleted( name: str, location: str, **kwargs: Any - ) -> "_models.DeletedManagedHsm": + ) -> _models.DeletedManagedHsm: """Gets the specified deleted managed HSM. :param name: The name of the deleted managed HSM. @@ -1063,13 +1145,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.DeletedManagedHsm :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedManagedHsm"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] request = build_get_deleted_request( @@ -1078,11 +1163,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1110,13 +1197,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1125,11 +1215,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1171,20 +1263,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore name=name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1194,8 +1291,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py index e0fb3fd1829c..071dc770d774 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -35,9 +35,12 @@ def build_list_by_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -49,18 +52,16 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -72,9 +73,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -87,18 +91,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -109,14 +111,17 @@ def build_put_request( name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.MHSMPrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -129,20 +134,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -156,9 +159,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateEndpointConnectionsOperations(object): - """MHSMPrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_resource( @@ -214,7 +216,7 @@ def list_by_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> Iterable["_models.MHSMPrivateEndpointConnectionsListResult"]: + ) -> Iterable[_models.MHSMPrivateEndpointConnectionsListResult]: """The List operation gets information about the private endpoint connections associated with the managed HSM Pool. @@ -229,13 +231,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnectionsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnectionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -245,9 +250,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -257,9 +264,11 @@ def prepare_request(next_link=None): name=name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -300,7 +309,7 @@ def get( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Gets the specified private endpoint connection associated with the managed HSM Pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -315,13 +324,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] request = build_get_request( @@ -331,11 +343,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -363,9 +377,9 @@ def put( resource_group_name: str, name: str, private_endpoint_connection_name: str, - properties: "_models.MHSMPrivateEndpointConnection", + properties: _models.MHSMPrivateEndpointConnection, **kwargs: Any - ) -> "_models.MHSMPrivateEndpointConnection": + ) -> _models.MHSMPrivateEndpointConnection: """Updates the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -382,14 +396,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') @@ -402,11 +419,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -437,14 +456,17 @@ def _delete_initial( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.MHSMPrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.MHSMPrivateEndpointConnection"]] + ) -> Optional[_models.MHSMPrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] request = build_delete_request_initial( @@ -454,11 +476,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -494,7 +518,7 @@ def begin_delete( name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.MHSMPrivateEndpointConnection"]: + ) -> LROPoller[_models.MHSMPrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -518,35 +542,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, name=name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_link_resources_operations.py index 84160061cc54..caeeb7e5d52c 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_mhsm_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_mhsm_resource_request( name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_mhsm_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class MHSMPrivateLinkResourcesOperations(object): - """MHSMPrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_mhsm_resource( @@ -88,7 +88,7 @@ def list_by_mhsm_resource( resource_group_name: str, name: str, **kwargs: Any - ) -> "_models.MHSMPrivateLinkResourceListResult": + ) -> _models.MHSMPrivateLinkResourceListResult: """Gets the private link resources supported for the managed hsm pool. :param resource_group_name: Name of the resource group that contains the managed HSM pool. @@ -100,13 +100,16 @@ def list_by_mhsm_resource( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.MHSMPrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.MHSMPrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] request = build_list_by_mhsm_resource_request( @@ -115,11 +118,13 @@ def list_by_mhsm_resource( name=name, api_version=api_version, template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_operations.py index 2747d65525fc..d2219873fde6 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_operations.py @@ -16,6 +16,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -29,55 +30,54 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/operations") # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class Operations(object): - """Operations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list( self, **kwargs: Any - ) -> Iterable["_models.OperationListResult"]: + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Key Vault Rest API operations. :keyword callable cls: A custom type or function that will be passed the direct response @@ -86,31 +86,38 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_request( api_version=api_version, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: request = build_list_request( api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py index 8cb3f38a420a..f90fd159ff3e 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -36,9 +36,12 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -51,18 +54,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -73,14 +74,17 @@ def build_put_request( vault_name: str, private_endpoint_connection_name: str, *, - json: JSONType = None, + json: Optional[_models.PrivateEndpointConnection] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -93,20 +97,18 @@ def build_put_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -120,9 +122,12 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { @@ -135,18 +140,16 @@ def build_delete_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -157,9 +160,12 @@ def build_list_by_resource_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections") # pylint: disable=line-too-long path_format_arguments = { @@ -171,42 +177,38 @@ def build_list_by_resource_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateEndpointConnectionsOperations(object): - """PrivateEndpointConnectionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def get( @@ -215,7 +217,7 @@ def get( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: + ) -> Optional[_models.PrivateEndpointConnection]: """Gets the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -230,13 +232,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection or None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_get_request( @@ -246,11 +251,13 @@ def get( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -279,9 +286,9 @@ def put( resource_group_name: str, vault_name: str, private_endpoint_connection_name: str, - properties: "_models.PrivateEndpointConnection", + properties: _models.PrivateEndpointConnection, **kwargs: Any - ) -> "_models.PrivateEndpointConnection": + ) -> _models.PrivateEndpointConnection: """Updates the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -298,14 +305,17 @@ def put( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] _json = self._serialize.body(properties, 'PrivateEndpointConnection') @@ -318,11 +328,13 @@ def put( content_type=content_type, json=_json, template_url=self.put.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -353,14 +365,17 @@ def _delete_initial( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Optional["_models.PrivateEndpointConnection"]: - cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.PrivateEndpointConnection"]] + ) -> Optional[_models.PrivateEndpointConnection]: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] request = build_delete_request_initial( @@ -370,11 +385,13 @@ def _delete_initial( private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -410,7 +427,7 @@ def begin_delete( vault_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller["_models.PrivateEndpointConnection"]: + ) -> LROPoller[_models.PrivateEndpointConnection]: """Deletes the specified private endpoint connection associated with the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -434,35 +451,45 @@ def begin_delete( ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnection] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnection"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, private_endpoint_connection_name=private_endpoint_connection_name, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -481,7 +508,7 @@ def list_by_resource( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> Iterable["_models.PrivateEndpointConnectionListResult"]: + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: """The List operation gets information about the private endpoint connections associated with the vault. @@ -496,13 +523,16 @@ def list_by_resource( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.PrivateEndpointConnectionListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -512,9 +542,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -524,9 +556,11 @@ def prepare_request(next_link=None): vault_name=vault_name, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_link_resources_operations.py index 6a652c334a56..d7e77e34e18a 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_link_resources_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_private_link_resources_operations.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models @@ -31,9 +32,12 @@ def build_list_by_vault_request( vault_name: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # pylint: disable=line-too-long path_format_arguments = { @@ -45,42 +49,38 @@ def build_list_by_vault_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class PrivateLinkResourcesOperations(object): - """PrivateLinkResourcesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def list_by_vault( @@ -88,7 +88,7 @@ def list_by_vault( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.PrivateLinkResourceListResult": + ) -> _models.PrivateLinkResourceListResult: """Gets the private link resources supported for the key vault. :param resource_group_name: Name of the resource group that contains the key vault. @@ -100,13 +100,16 @@ def list_by_vault( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.PrivateLinkResourceListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] request = build_list_by_vault_request( @@ -115,11 +118,13 @@ def list_by_vault( vault_name=vault_name, api_version=api_version, template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py index 777debae89db..1b12aa93d3b1 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_secrets_operations.py @@ -16,12 +16,12 @@ from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models from .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -33,14 +33,17 @@ def build_create_or_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -79,14 +80,17 @@ def build_update_request( secret_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.SecretPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -99,20 +103,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -126,9 +128,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long path_format_arguments = { @@ -141,18 +146,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -165,9 +168,12 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") # pylint: disable=line-too-long path_format_arguments = { @@ -179,44 +185,40 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) -class SecretsOperations(object): - """SecretsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`secrets` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + @distributed_trace def create_or_update( @@ -224,9 +226,9 @@ def create_or_update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretCreateOrUpdateParameters", + parameters: _models.SecretCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -244,14 +246,17 @@ def create_or_update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') @@ -264,11 +269,13 @@ def create_or_update( content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -299,9 +306,9 @@ def update( resource_group_name: str, vault_name: str, secret_name: str, - parameters: "_models.SecretPatchParameters", + parameters: _models.SecretPatchParameters, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Update a secret in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -319,14 +326,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] _json = self._serialize.body(parameters, 'SecretPatchParameters') @@ -339,11 +349,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -375,7 +387,7 @@ def get( vault_name: str, secret_name: str, **kwargs: Any - ) -> "_models.Secret": + ) -> _models.Secret: """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -390,13 +402,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Secret :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Secret"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] request = build_get_request( @@ -406,11 +421,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -438,7 +455,7 @@ def list( vault_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.SecretListResult"]: + ) -> Iterable[_models.SecretListResult]: """The List operation gets information about the secrets in a vault. NOTE: This API is intended for internal use in ARM deployments. Users should use the data-plane REST service for interaction with vault secrets. @@ -454,13 +471,16 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.SecretListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -471,9 +491,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -484,9 +506,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py index beb06ede12b2..c27fdc7a11fd 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2021_10_01/operations/_vaults_operations.py @@ -6,7 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast from msrest import Serializer @@ -17,13 +17,13 @@ from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest 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 .._vendor import _convert_request, _format_url_section T = TypeVar('T') -JSONType = Any ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] _SERIALIZER = Serializer() @@ -34,14 +34,17 @@ def build_create_or_update_request_initial( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -53,20 +56,18 @@ def build_create_or_update_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -78,14 +79,17 @@ def build_update_request( vault_name: str, subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultPatchParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -97,20 +101,18 @@ def build_update_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -123,9 +125,12 @@ def build_delete_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -137,18 +142,16 @@ def build_delete_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -159,9 +162,12 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -173,18 +179,16 @@ def build_get_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -195,14 +199,17 @@ def build_update_access_policy_request( operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultAccessPolicyParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long path_format_arguments = { @@ -215,20 +222,18 @@ def build_update_access_policy_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs @@ -242,9 +247,12 @@ def build_list_by_resource_group_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long path_format_arguments = { @@ -255,20 +263,18 @@ def build_list_by_resource_group_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -279,9 +285,12 @@ def build_list_by_subscription_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") path_format_arguments = { @@ -291,20 +300,18 @@ def build_list_by_subscription_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -313,9 +320,12 @@ def build_list_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") path_format_arguments = { @@ -325,18 +335,16 @@ def build_list_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -347,9 +355,12 @@ def build_get_deleted_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long path_format_arguments = { @@ -361,18 +372,16 @@ def build_get_deleted_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -383,9 +392,12 @@ def build_purge_deleted_request_initial( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long path_format_arguments = { @@ -397,18 +409,16 @@ def build_purge_deleted_request_initial( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -419,10 +429,13 @@ def build_list_request( top: Optional[int] = None, **kwargs: Any ) -> HttpRequest: - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resources") path_format_arguments = { @@ -432,21 +445,19 @@ def build_list_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _params['$filter'] = _SERIALIZER.query("filter", filter, 'str') if top is not None: - _query_parameters['$top'] = _SERIALIZER.query("top", top, 'int') - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['$top'] = _SERIALIZER.query("top", top, 'int') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, **kwargs ) @@ -454,14 +465,17 @@ def build_list_request( def build_check_name_availability_request( subscription_id: str, *, - json: JSONType = None, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, content: Any = None, **kwargs: Any ) -> HttpRequest: - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', None) # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") - accept = "application/json" # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") path_format_arguments = { @@ -471,62 +485,61 @@ def build_check_name_availability_request( _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", url=_url, - params=_query_parameters, - headers=_header_parameters, + params=_params, + headers=_headers, json=json, content=content, **kwargs ) -class VaultsOperations(object): - """VaultsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.keyvault.v2021_10_01.models - :param client: Client for service requests. - :param config: Configuration of service client. - :param serializer: An object model serializer. - :param deserializer: An object model deserializer. + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2021_10_01.KeyVaultManagementClient`'s + :attr:`vaults` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + 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") + def _create_or_update_initial( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> "_models.Vault": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] + ) -> _models.Vault: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') @@ -538,11 +551,13 @@ def _create_or_update_initial( content_type=content_type, json=_json, template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -572,9 +587,9 @@ def begin_create_or_update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultCreateOrUpdateParameters", + parameters: _models.VaultCreateOrUpdateParameters, **kwargs: Any - ) -> LROPoller["_models.Vault"]: + ) -> LROPoller[_models.Vault]: """Create or update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -595,37 +610,47 @@ def begin_create_or_update( :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2021_10_01.models.Vault] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, vault_name=vault_name, parameters=parameters, api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) def get_long_running_output(pipeline_response): - response = pipeline_response.http_response deserialized = self._deserialize('Vault', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -643,9 +668,9 @@ def update( self, resource_group_name: str, vault_name: str, - parameters: "_models.VaultPatchParameters", + parameters: _models.VaultPatchParameters, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Update a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the server belongs. @@ -659,14 +684,17 @@ def update( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] _json = self._serialize.body(parameters, 'VaultPatchParameters') @@ -678,11 +706,13 @@ def update( content_type=content_type, json=_json, template_url=self.update.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -725,13 +755,16 @@ def delete( # pylint: disable=inconsistent-return-statements :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_delete_request( @@ -740,11 +773,13 @@ def delete( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -767,7 +802,7 @@ def get( resource_group_name: str, vault_name: str, **kwargs: Any - ) -> "_models.Vault": + ) -> _models.Vault: """Gets the specified Azure key vault. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -779,13 +814,16 @@ def get( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.Vault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Vault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] request = build_get_request( @@ -794,11 +832,13 @@ def get( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -825,9 +865,9 @@ def update_access_policy( resource_group_name: str, vault_name: str, operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], - parameters: "_models.VaultAccessPolicyParameters", + parameters: _models.VaultAccessPolicyParameters, **kwargs: Any - ) -> "_models.VaultAccessPolicyParameters": + ) -> _models.VaultAccessPolicyParameters: """Update access policies in a key vault in the specified subscription. :param resource_group_name: The name of the Resource Group to which the vault belongs. @@ -843,14 +883,17 @@ def update_access_policy( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.VaultAccessPolicyParameters :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultAccessPolicyParameters"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') @@ -863,11 +906,13 @@ def update_access_policy( content_type=content_type, json=_json, template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -898,7 +943,7 @@ def list_by_resource_group( resource_group_name: str, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription and within the specified resource group. @@ -911,13 +956,16 @@ def list_by_resource_group( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -927,9 +975,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -939,9 +989,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -979,7 +1031,7 @@ def list_by_subscription( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.VaultListResult"]: + ) -> Iterable[_models.VaultListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -989,13 +1041,16 @@ def list_by_subscription( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.VaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.VaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1004,9 +1059,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1015,9 +1072,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1054,7 +1113,7 @@ def get_next(next_link=None): def list_deleted( self, **kwargs: Any - ) -> Iterable["_models.DeletedVaultListResult"]: + ) -> Iterable[_models.DeletedVaultListResult]: """Gets information about the deleted vaults in a subscription. :keyword callable cls: A custom type or function that will be passed the direct response @@ -1064,13 +1123,16 @@ def list_deleted( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.DeletedVaultListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVaultListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1078,9 +1140,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1088,9 +1152,11 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, api_version=api_version, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1129,7 +1195,7 @@ def get_deleted( vault_name: str, location: str, **kwargs: Any - ) -> "_models.DeletedVault": + ) -> _models.DeletedVault: """Gets the deleted Azure key vault. :param vault_name: The name of the vault. @@ -1141,13 +1207,16 @@ def get_deleted( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.DeletedVault :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.DeletedVault"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] request = build_get_deleted_request( @@ -1156,11 +1225,13 @@ def get_deleted( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1187,13 +1258,16 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements location: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) - api_version = kwargs.pop('api_version', "2021-10-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] request = build_purge_deleted_request_initial( @@ -1202,11 +1276,13 @@ def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs @@ -1248,20 +1324,25 @@ def begin_purge_deleted( # pylint: disable=inconsistent-return-statements :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - api_version = kwargs.pop('api_version', "2021-10-01") # type: str - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._purge_deleted_initial( + raw_result = self._purge_deleted_initial( # type: ignore vault_name=vault_name, location=location, api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) kwargs.pop('error_map', None) @@ -1271,8 +1352,14 @@ def get_long_running_output(pipeline_response): return cls(pipeline_response, None, {}) - if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -1290,7 +1377,7 @@ def list( self, top: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.ResourceListResult"]: + ) -> Iterable[_models.ResourceListResult]: """The List operation gets information about the vaults associated with the subscription. :param top: Maximum number of results to return. Default value is None. @@ -1308,14 +1395,17 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2021_10_01.models.ResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - filter = kwargs.pop('filter', "resourceType eq 'Microsoft.KeyVault/vaults'") # type: str - api_version = kwargs.pop('api_version', "2015-11-01") # type: str + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): if not next_link: @@ -1325,9 +1415,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=self.list.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore else: @@ -1337,9 +1429,11 @@ def prepare_request(next_link=None): api_version=api_version, top=top, template_url=next_link, + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore request.method = "GET" return request @@ -1375,9 +1469,9 @@ def get_next(next_link=None): @distributed_trace def check_name_availability( self, - vault_name: "_models.VaultCheckNameAvailabilityParameters", + vault_name: _models.VaultCheckNameAvailabilityParameters, **kwargs: Any - ) -> "_models.CheckNameAvailabilityResult": + ) -> _models.CheckNameAvailabilityResult: """Checks that the vault name is valid and is not already in use. :param vault_name: The name of the vault. @@ -1387,14 +1481,17 @@ def check_name_availability( :rtype: ~azure.mgmt.keyvault.v2021_10_01.models.CheckNameAvailabilityResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) + 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 = kwargs.pop('api_version', "2021-10-01") # type: str - content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-10-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') @@ -1404,11 +1501,13 @@ def check_name_availability( content_type=content_type, json=_json, template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, ) request = _convert_request(request) - request.url = self._client.format_url(request.url) + request.url = self._client.format_url(request.url) # type: ignore - pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access request, stream=False, **kwargs diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/__init__.py new file mode 100644 index 000000000000..d19915ab3650 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/__init__.py @@ -0,0 +1,23 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._key_vault_management_client import KeyVaultManagementClient +from ._version import VERSION + +__version__ = VERSION + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_configuration.py new file mode 100644 index 000000000000..78cc20decbaa --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_configuration.py @@ -0,0 +1,74 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class KeyVaultManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-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: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-07-01") # type: str + + 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-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_key_vault_management_client.py new file mode 100644 index 000000000000..d39e64b6c8ae --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_key_vault_management_client.py @@ -0,0 +1,145 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class KeyVaultManagementClient: # pylint: disable=too-many-instance-attributes + """The Azure management API provides a RESTful set of web services that interact with Azure Key + Vault. + + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2022_07_01.operations.KeysOperations + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2022_07_01.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2022_07_01.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.keyvault.v2022_07_01.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2022_07_01.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2022_07_01.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2022_07_01.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2022_07_01.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2022_07_01.operations.SecretsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> KeyVaultManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_metadata.json b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_metadata.json new file mode 100644 index 000000000000..b5d04d422c70 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_metadata.json @@ -0,0 +1,110 @@ +{ + "chosen_version": "2022-07-01", + "total_api_version_list": ["2022-07-01"], + "client": { + "name": "KeyVaultManagementClient", + "filename": "_key_vault_management_client", + "description": "The Azure management API provides a RESTful set of web services that interact with Azure Key Vault.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"KeyVaultManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "keys": "KeysOperations", + "vaults": "VaultsOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations", + "managed_hsms": "ManagedHsmsOperations", + "mhsm_private_endpoint_connections": "MHSMPrivateEndpointConnectionsOperations", + "mhsm_private_link_resources": "MHSMPrivateLinkResourcesOperations", + "operations": "Operations", + "secrets": "SecretsOperations" + } +} \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_vendor.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/_version.py new file mode 100644 index 000000000000..c1257f7f4e11 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_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 = "10.1.0" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/__init__.py new file mode 100644 index 000000000000..1aa2a0b291a3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/__init__.py @@ -0,0 +1,20 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._key_vault_management_client import KeyVaultManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['KeyVaultManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_configuration.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_configuration.py new file mode 100644 index 000000000000..3f7026a664c5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class KeyVaultManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for KeyVaultManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-07-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: + super(KeyVaultManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-07-01") # type: str + + 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-keyvault/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_key_vault_management_client.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_key_vault_management_client.py new file mode 100644 index 000000000000..eef1838440d3 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_key_vault_management_client.py @@ -0,0 +1,142 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import KeyVaultManagementClientConfiguration +from .operations import KeysOperations, MHSMPrivateEndpointConnectionsOperations, MHSMPrivateLinkResourcesOperations, ManagedHsmsOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, SecretsOperations, VaultsOperations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class KeyVaultManagementClient: # pylint: disable=too-many-instance-attributes + """The Azure management API provides a RESTful set of web services that interact with Azure Key + Vault. + + :ivar keys: KeysOperations operations + :vartype keys: azure.mgmt.keyvault.v2022_07_01.aio.operations.KeysOperations + :ivar vaults: VaultsOperations operations + :vartype vaults: azure.mgmt.keyvault.v2022_07_01.aio.operations.VaultsOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: + azure.mgmt.keyvault.v2022_07_01.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: + azure.mgmt.keyvault.v2022_07_01.aio.operations.PrivateLinkResourcesOperations + :ivar managed_hsms: ManagedHsmsOperations operations + :vartype managed_hsms: azure.mgmt.keyvault.v2022_07_01.aio.operations.ManagedHsmsOperations + :ivar mhsm_private_endpoint_connections: MHSMPrivateEndpointConnectionsOperations operations + :vartype mhsm_private_endpoint_connections: + azure.mgmt.keyvault.v2022_07_01.aio.operations.MHSMPrivateEndpointConnectionsOperations + :ivar mhsm_private_link_resources: MHSMPrivateLinkResourcesOperations operations + :vartype mhsm_private_link_resources: + azure.mgmt.keyvault.v2022_07_01.aio.operations.MHSMPrivateLinkResourcesOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.keyvault.v2022_07_01.aio.operations.Operations + :ivar secrets: SecretsOperations operations + :vartype secrets: azure.mgmt.keyvault.v2022_07_01.aio.operations.SecretsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-07-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: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = KeyVaultManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.keys = KeysOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.vaults = VaultsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.managed_hsms = ManagedHsmsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_endpoint_connections = MHSMPrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.mhsm_private_link_resources = MHSMPrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize + ) + self.secrets = SecretsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "KeyVaultManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/__init__.py new file mode 100644 index 000000000000..49be258e3efc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/__init__.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._keys_operations import KeysOperations +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_hsms_operations import ManagedHsmsOperations +from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations +from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations +from ._operations import Operations +from ._secrets_operations import SecretsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'KeysOperations', + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_keys_operations.py new file mode 100644 index 000000000000..dce18a0677ee --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_keys_operations.py @@ -0,0 +1,447 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._keys_operations import build_create_if_not_exist_request, build_get_request, build_get_version_request, build_list_request, build_list_versions_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`keys` attribute. + """ + + models = _models + + 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") + + + @distributed_trace_async + async def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: _models.KeyCreateParameters, + **kwargs: Any + ) -> _models.Key: + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + _json = self._serialize.body(parameters, 'KeyCreateParameters') + + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_if_not_exist.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> _models.Key: + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.KeyListResult]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("KeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys"} # type: ignore + + @distributed_trace_async + async def get_version( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> _models.Key: + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + api_version=api_version, + template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}"} # type: ignore + + + @distributed_trace + def list_versions( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.KeyListResult]: + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("KeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py new file mode 100644 index 000000000000..a422eae3f7f5 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_managed_hsms_operations.py @@ -0,0 +1,1039 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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 ..._vendor import _convert_request +from ...operations._managed_hsms_operations import build_check_mhsm_name_availability_request, build_create_or_update_request_initial, build_delete_request_initial, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_purge_deleted_request_initial, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. + """ + + models = _models + + 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") + + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> _models.ManagedHsm: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> _models.ManagedHsm: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedHsm or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional[_models.ManagedHsm]: + """Gets the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] + + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedHsmListResult]: + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.ManagedHsmListResult]: + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs"} # type: ignore + + @distributed_trace + def list_deleted( + self, + **kwargs: Any + ) -> AsyncIterable[_models.DeletedManagedHsmListResult]: + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs"} # type: ignore + + @distributed_trace_async + async def get_deleted( + self, + name: str, + location: str, + **kwargs: Any + ) -> _models.DeletedManagedHsm: + """Gets the specified deleted managed HSM. + + :param name: The name of the deleted managed HSM. + :type name: str + :param location: The location of the deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsm + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] + + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}"} # type: ignore + + + async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements + self, + name: str, + location: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge"} # type: ignore + + + @distributed_trace_async + async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements + self, + name: str, + location: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes the specified managed HSM. + + :param name: The name of the soft-deleted managed HSM. + :type name: str + :param location: The location of the soft-deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( # type: ignore + name=name, + location=location, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge"} # type: ignore + + @distributed_trace_async + async def check_mhsm_name_availability( + self, + mhsm_name: _models.CheckMhsmNameAvailabilityParameters, + **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The name of the managed hsm. + :type mhsm_name: ~azure.mgmt.keyvault.v2022_07_01.models.CheckMhsmNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckMhsmNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.CheckMhsmNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckMhsmNameAvailabilityResult] + + _json = self._serialize.body(mhsm_name, 'CheckMhsmNameAvailabilityParameters') + + request = build_check_mhsm_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_mhsm_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('CheckMhsmNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_mhsm_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..4bb1a36372c8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_endpoint_connections_operations.py @@ -0,0 +1,429 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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 ..._vendor import _convert_request +from ...operations._mhsm_private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncIterable[_models.MHSMPrivateEndpointConnectionsListResult]: + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnectionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: _models.MHSMPrivateEndpointConnection, + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.MHSMPrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.MHSMPrivateEndpointConnection]: + """Deletes the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 000000000000..5dca2b6aad1a --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_mhsm_private_link_resources_operations.py @@ -0,0 +1,106 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._mhsm_private_link_resources_operations import build_list_by_mhsm_resource_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. + """ + + models = _models + + 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") + + + @distributed_trace_async + async def list_by_mhsm_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> _models.MHSMPrivateLinkResourceListResult: + """Gets the private link resources supported for the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] + + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('MHSMPrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_mhsm_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_operations.py new file mode 100644 index 000000000000..d07acd303e5d --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_operations.py @@ -0,0 +1,121 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable[_models.OperationListResult]: + """Lists all of the available Key Vault Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.KeyVault/operations"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..2a8480724800 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,430 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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 ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_request_initial, build_get_request, build_list_by_resource_request, build_put_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + 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") + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + """Gets the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + async def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Deletes the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]: + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..a4fbf4cc18f1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,106 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_vault_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + 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") + + + @distributed_trace_async + async def list_by_vault( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources supported for the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_vault.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py new file mode 100644 index 000000000000..d7080d77aa9c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_secrets_operations.py @@ -0,0 +1,369 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._secrets_operations import build_create_or_update_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`secrets` attribute. + """ + + models = _models + + 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") + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretCreateOrUpdateParameters, + **kwargs: Any + ) -> _models.Secret: + """Create or update a secret in a key vault in the specified subscription. NOTE: This API is + intended for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to create or update the secret. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.SecretCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretPatchParameters, + **kwargs: Any + ) -> _models.Secret: + """Update a secret in the specified subscription. NOTE: This API is intended for internal use in + ARM deployments. Users should use the data-plane REST service for interaction with vault + secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to patch the secret. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.SecretPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + **kwargs: Any + ) -> _models.Secret: + """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. + Users should use the data-plane REST service for interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.SecretListResult]: + """The List operation gets information about the secrets in a vault. NOTE: This API is intended + for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SecretListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py new file mode 100644 index 000000000000..0beb9b7aee05 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/aio/operations/_vaults_operations.py @@ -0,0 +1,1055 @@ +# pylint: disable=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 typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.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 ..._vendor import _convert_request +from ...operations._vaults_operations import build_check_name_availability_request, build_create_or_update_request_initial, build_delete_request, build_get_deleted_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_deleted_request, build_list_request, build_purge_deleted_request_initial, build_update_access_policy_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.aio.KeyVaultManagementClient`'s + :attr:`vaults` attribute. + """ + + models = _models + + 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") + + + async def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + **kwargs: Any + ) -> _models.Vault: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + **kwargs: Any + ) -> AsyncLROPoller[_models.Vault]: + """Create or update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.keyvault.v2022_07_01.models.Vault] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultPatchParameters, + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> _models.Vault: + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace_async + async def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: _models.VaultAccessPolicyParameters, + **kwargs: Any + ) -> _models.VaultAccessPolicyParameters: + """Update access policies in a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_access_policy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.VaultListResult]: + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.VaultListResult]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults"} # type: ignore + + @distributed_trace + def list_deleted( + self, + **kwargs: Any + ) -> AsyncIterable[_models.DeletedVaultListResult]: + """Gets information about the deleted vaults in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.DeletedVaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults"} # type: ignore + + @distributed_trace_async + async def get_deleted( + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> _models.DeletedVault: + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] + + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}"} # type: ignore + + + async def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge"} # type: ignore + + + @distributed_trace_async + async def begin_purge_deleted( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._purge_deleted_initial( # type: ignore + vault_name=vault_name, + location=location, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge"} # type: ignore + + @distributed_trace + def list( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> AsyncIterable[_models.ResourceListResult]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword filter: The filter to apply on the operation. Default value is "resourceType eq + 'Microsoft.KeyVault/vaults'". Note that overriding this default value may result in unsupported + behavior. + :paramtype filter: str + :keyword api_version: Azure Resource Manager Api Version. Default value is "2015-11-01". Note + that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + top=top, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + 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) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resources"} # type: ignore + + @distributed_trace_async + async def check_name_availability( + self, + vault_name: _models.VaultCheckNameAvailabilityParameters, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2022_07_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/__init__.py new file mode 100644 index 000000000000..e9fe5fb6248c --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/__init__.py @@ -0,0 +1,229 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import AccessPolicyEntry +from ._models_py3 import Action +from ._models_py3 import Attributes +from ._models_py3 import CheckMhsmNameAvailabilityParameters +from ._models_py3 import CheckMhsmNameAvailabilityResult +from ._models_py3 import CheckNameAvailabilityResult +from ._models_py3 import CloudErrorBody +from ._models_py3 import DeletedManagedHsm +from ._models_py3 import DeletedManagedHsmListResult +from ._models_py3 import DeletedManagedHsmProperties +from ._models_py3 import DeletedVault +from ._models_py3 import DeletedVaultListResult +from ._models_py3 import DeletedVaultProperties +from ._models_py3 import DimensionProperties +from ._models_py3 import Error +from ._models_py3 import IPRule +from ._models_py3 import Key +from ._models_py3 import KeyAttributes +from ._models_py3 import KeyCreateParameters +from ._models_py3 import KeyListResult +from ._models_py3 import KeyProperties +from ._models_py3 import KeyReleasePolicy +from ._models_py3 import KeyRotationPolicyAttributes +from ._models_py3 import LifetimeAction +from ._models_py3 import LogSpecification +from ._models_py3 import MHSMIPRule +from ._models_py3 import MHSMNetworkRuleSet +from ._models_py3 import MHSMPrivateEndpoint +from ._models_py3 import MHSMPrivateEndpointConnection +from ._models_py3 import MHSMPrivateEndpointConnectionItem +from ._models_py3 import MHSMPrivateEndpointConnectionsListResult +from ._models_py3 import MHSMPrivateLinkResource +from ._models_py3 import MHSMPrivateLinkResourceListResult +from ._models_py3 import MHSMPrivateLinkServiceConnectionState +from ._models_py3 import MHSMVirtualNetworkRule +from ._models_py3 import ManagedHSMSecurityDomainProperties +from ._models_py3 import ManagedHsm +from ._models_py3 import ManagedHsmError +from ._models_py3 import ManagedHsmListResult +from ._models_py3 import ManagedHsmProperties +from ._models_py3 import ManagedHsmResource +from ._models_py3 import ManagedHsmSku +from ._models_py3 import MetricSpecification +from ._models_py3 import NetworkRuleSet +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Permissions +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionItem +from ._models_py3 import PrivateEndpointConnectionListResult +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import Resource +from ._models_py3 import ResourceListResult +from ._models_py3 import RotationPolicy +from ._models_py3 import Secret +from ._models_py3 import SecretAttributes +from ._models_py3 import SecretCreateOrUpdateParameters +from ._models_py3 import SecretListResult +from ._models_py3 import SecretPatchParameters +from ._models_py3 import SecretPatchProperties +from ._models_py3 import SecretProperties +from ._models_py3 import ServiceSpecification +from ._models_py3 import Sku +from ._models_py3 import SystemData +from ._models_py3 import Trigger +from ._models_py3 import Vault +from ._models_py3 import VaultAccessPolicyParameters +from ._models_py3 import VaultAccessPolicyProperties +from ._models_py3 import VaultCheckNameAvailabilityParameters +from ._models_py3 import VaultCreateOrUpdateParameters +from ._models_py3 import VaultListResult +from ._models_py3 import VaultPatchParameters +from ._models_py3 import VaultPatchProperties +from ._models_py3 import VaultProperties +from ._models_py3 import VirtualNetworkRule + + +from ._key_vault_management_client_enums import ( + AccessPolicyUpdateKind, + ActionsRequired, + ActivationStatus, + CertificatePermissions, + CreateMode, + DeletionRecoveryLevel, + IdentityType, + JsonWebKeyCurveName, + JsonWebKeyOperation, + JsonWebKeyType, + KeyPermissions, + KeyRotationPolicyActionType, + ManagedHsmSkuFamily, + ManagedHsmSkuName, + NetworkRuleAction, + NetworkRuleBypassOptions, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProvisioningState, + PublicNetworkAccess, + Reason, + SecretPermissions, + SkuFamily, + SkuName, + StoragePermissions, + VaultProvisioningState, +) +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'AccessPolicyEntry', + 'Action', + 'Attributes', + 'CheckMhsmNameAvailabilityParameters', + 'CheckMhsmNameAvailabilityResult', + 'CheckNameAvailabilityResult', + 'CloudErrorBody', + 'DeletedManagedHsm', + 'DeletedManagedHsmListResult', + 'DeletedManagedHsmProperties', + 'DeletedVault', + 'DeletedVaultListResult', + 'DeletedVaultProperties', + 'DimensionProperties', + 'Error', + 'IPRule', + 'Key', + 'KeyAttributes', + 'KeyCreateParameters', + 'KeyListResult', + 'KeyProperties', + 'KeyReleasePolicy', + 'KeyRotationPolicyAttributes', + 'LifetimeAction', + 'LogSpecification', + 'MHSMIPRule', + 'MHSMNetworkRuleSet', + 'MHSMPrivateEndpoint', + 'MHSMPrivateEndpointConnection', + 'MHSMPrivateEndpointConnectionItem', + 'MHSMPrivateEndpointConnectionsListResult', + 'MHSMPrivateLinkResource', + 'MHSMPrivateLinkResourceListResult', + 'MHSMPrivateLinkServiceConnectionState', + 'MHSMVirtualNetworkRule', + 'ManagedHSMSecurityDomainProperties', + 'ManagedHsm', + 'ManagedHsmError', + 'ManagedHsmListResult', + 'ManagedHsmProperties', + 'ManagedHsmResource', + 'ManagedHsmSku', + 'MetricSpecification', + 'NetworkRuleSet', + 'Operation', + 'OperationDisplay', + 'OperationListResult', + 'Permissions', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionItem', + 'PrivateEndpointConnectionListResult', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'Resource', + 'ResourceListResult', + 'RotationPolicy', + 'Secret', + 'SecretAttributes', + 'SecretCreateOrUpdateParameters', + 'SecretListResult', + 'SecretPatchParameters', + 'SecretPatchProperties', + 'SecretProperties', + 'ServiceSpecification', + 'Sku', + 'SystemData', + 'Trigger', + 'Vault', + 'VaultAccessPolicyParameters', + 'VaultAccessPolicyProperties', + 'VaultCheckNameAvailabilityParameters', + 'VaultCreateOrUpdateParameters', + 'VaultListResult', + 'VaultPatchParameters', + 'VaultPatchProperties', + 'VaultProperties', + 'VirtualNetworkRule', + 'AccessPolicyUpdateKind', + 'ActionsRequired', + 'ActivationStatus', + 'CertificatePermissions', + 'CreateMode', + 'DeletionRecoveryLevel', + 'IdentityType', + 'JsonWebKeyCurveName', + 'JsonWebKeyOperation', + 'JsonWebKeyType', + 'KeyPermissions', + 'KeyRotationPolicyActionType', + 'ManagedHsmSkuFamily', + 'ManagedHsmSkuName', + 'NetworkRuleAction', + 'NetworkRuleBypassOptions', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'ProvisioningState', + 'PublicNetworkAccess', + 'Reason', + 'SecretPermissions', + 'SkuFamily', + 'SkuName', + 'StoragePermissions', + 'VaultProvisioningState', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_key_vault_management_client_enums.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_key_vault_management_client_enums.py new file mode 100644 index 000000000000..63b601387398 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_key_vault_management_client_enums.py @@ -0,0 +1,282 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license 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 AccessPolicyUpdateKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + ADD = "add" + REPLACE = "replace" + REMOVE = "remove" + +class ActionsRequired(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A message indicating if changes on the service provider require any updates on the consumer. + """ + + NONE = "None" + +class ActivationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Activation Status + """ + + #: The managed HSM Pool is active. + ACTIVE = "Active" + #: The managed HSM Pool is not yet activated. + NOT_ACTIVATED = "NotActivated" + #: An unknown error occurred while activating managed hsm. + UNKNOWN = "Unknown" + #: Failed to activate managed hsm. + FAILED = "Failed" + +class CertificatePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + ALL = "all" + GET = "get" + LIST = "list" + DELETE = "delete" + CREATE = "create" + IMPORT_ENUM = "import" + UPDATE = "update" + MANAGECONTACTS = "managecontacts" + GETISSUERS = "getissuers" + LISTISSUERS = "listissuers" + SETISSUERS = "setissuers" + DELETEISSUERS = "deleteissuers" + MANAGEISSUERS = "manageissuers" + RECOVER = "recover" + PURGE = "purge" + BACKUP = "backup" + RESTORE = "restore" + +class CreateMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The vault's create mode to indicate whether the vault need to be recovered or not. + """ + + RECOVER = "recover" + DEFAULT = "default" + +class DeletionRecoveryLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The deletion recovery level currently in effect for the object. If it contains 'Purgeable', + then the object can be permanently deleted by a privileged user; otherwise, only the system can + purge the object at the end of the retention interval. + """ + + PURGEABLE = "Purgeable" + RECOVERABLE_PURGEABLE = "Recoverable+Purgeable" + RECOVERABLE = "Recoverable" + RECOVERABLE_PROTECTED_SUBSCRIPTION = "Recoverable+ProtectedSubscription" + +class IdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of identity. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class JsonWebKeyCurveName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The elliptic curve name. For valid values, see JsonWebKeyCurveName. + """ + + P256 = "P-256" + P384 = "P-384" + P521 = "P-521" + P256_K = "P-256K" + +class JsonWebKeyOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The permitted JSON web key operations of the key. For more information, see + JsonWebKeyOperation. + """ + + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + SIGN = "sign" + VERIFY = "verify" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + IMPORT_ENUM = "import" + RELEASE = "release" + +class JsonWebKeyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of the key. For valid values, see JsonWebKeyType. + """ + + EC = "EC" + EC_HSM = "EC-HSM" + RSA = "RSA" + RSA_HSM = "RSA-HSM" + +class KeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + ALL = "all" + ENCRYPT = "encrypt" + DECRYPT = "decrypt" + WRAP_KEY = "wrapKey" + UNWRAP_KEY = "unwrapKey" + SIGN = "sign" + VERIFY = "verify" + GET = "get" + LIST = "list" + CREATE = "create" + UPDATE = "update" + IMPORT_ENUM = "import" + DELETE = "delete" + BACKUP = "backup" + RESTORE = "restore" + RECOVER = "recover" + PURGE = "purge" + RELEASE = "release" + ROTATE = "rotate" + GETROTATIONPOLICY = "getrotationpolicy" + SETROTATIONPOLICY = "setrotationpolicy" + +class KeyRotationPolicyActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of action. + """ + + ROTATE = "rotate" + NOTIFY = "notify" + +class ManagedHsmSkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SKU Family of the managed HSM Pool + """ + + B = "B" + +class ManagedHsmSkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SKU of the managed HSM Pool + """ + + STANDARD_B1 = "Standard_B1" + CUSTOM_B32 = "Custom_B32" + +class NetworkRuleAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The default action when no rule from ipRules and from virtualNetworkRules match. This is only + used after the bypass property has been evaluated. + """ + + ALLOW = "Allow" + DENY = "Deny" + +class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Tells what traffic can bypass network rules. This can be 'AzureServices' or 'None'. If not + specified the default is 'AzureServices'. + """ + + AZURE_SERVICES = "AzureServices" + NONE = "None" + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + FAILED = "Failed" + DISCONNECTED = "Disconnected" + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + DISCONNECTED = "Disconnected" + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state. + """ + + #: The managed HSM Pool has been full provisioned. + SUCCEEDED = "Succeeded" + #: The managed HSM Pool is currently being provisioned. + PROVISIONING = "Provisioning" + #: Provisioning of the managed HSM Pool has failed. + FAILED = "Failed" + #: The managed HSM Pool is currently being updated. + UPDATING = "Updating" + #: The managed HSM Pool is currently being deleted. + DELETING = "Deleting" + #: The managed HSM pool is ready for normal use. + ACTIVATED = "Activated" + #: The managed HSM pool is waiting for a security domain restore action. + SECURITY_DOMAIN_RESTORE = "SecurityDomainRestore" + #: The managed HSM pool is being restored from full HSM backup. + RESTORING = "Restoring" + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Control permission for data plane traffic coming from public networks while private endpoint is + enabled. + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class Reason(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The reason that a vault name could not be used. The Reason element is only returned if + NameAvailable is false. + """ + + ACCOUNT_NAME_INVALID = "AccountNameInvalid" + ALREADY_EXISTS = "AlreadyExists" + +class SecretPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + ALL = "all" + GET = "get" + LIST = "list" + SET = "set" + DELETE = "delete" + BACKUP = "backup" + RESTORE = "restore" + RECOVER = "recover" + PURGE = "purge" + +class SkuFamily(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SKU family name + """ + + A = "A" + +class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """SKU name to specify whether the key vault is a standard vault or a premium vault. + """ + + STANDARD = "standard" + PREMIUM = "premium" + +class StoragePermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + ALL = "all" + GET = "get" + LIST = "list" + DELETE = "delete" + SET = "set" + UPDATE = "update" + REGENERATEKEY = "regeneratekey" + RECOVER = "recover" + PURGE = "purge" + BACKUP = "backup" + RESTORE = "restore" + SETSAS = "setsas" + LISTSAS = "listsas" + GETSAS = "getsas" + DELETESAS = "deletesas" + +class VaultProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the vault. + """ + + SUCCEEDED = "Succeeded" + REGISTERING_DNS = "RegisteringDns" diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_models_py3.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_models_py3.py new file mode 100644 index 000000000000..f0fabe3cd085 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_models_py3.py @@ -0,0 +1,3965 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, TYPE_CHECKING, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models + + +class AccessPolicyEntry(msrest.serialization.Model): + """An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :vartype tenant_id: str + :ivar object_id: Required. The object ID of a user, service principal or security group in the + Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. + :vartype object_id: str + :ivar application_id: Application ID of the client making request on behalf of a principal. + :vartype application_id: str + :ivar permissions: Required. Permissions the identity has for keys, secrets and certificates. + :vartype permissions: ~azure.mgmt.keyvault.v2022_07_01.models.Permissions + """ + + _validation = { + 'tenant_id': {'required': True}, + 'object_id': {'required': True}, + 'permissions': {'required': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'object_id': {'key': 'objectId', 'type': 'str'}, + 'application_id': {'key': 'applicationId', 'type': 'str'}, + 'permissions': {'key': 'permissions', 'type': 'Permissions'}, + } + + def __init__( + self, + *, + tenant_id: str, + object_id: str, + permissions: "_models.Permissions", + application_id: Optional[str] = None, + **kwargs + ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword object_id: Required. The object ID of a user, service principal or security group in + the Azure Active Directory tenant for the vault. The object ID must be unique for the list of + access policies. + :paramtype object_id: str + :keyword application_id: Application ID of the client making request on behalf of a principal. + :paramtype application_id: str + :keyword permissions: Required. Permissions the identity has for keys, secrets and + certificates. + :paramtype permissions: ~azure.mgmt.keyvault.v2022_07_01.models.Permissions + """ + super(AccessPolicyEntry, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.object_id = object_id + self.application_id = application_id + self.permissions = permissions + + +class Action(msrest.serialization.Model): + """Action. + + :ivar type: The type of action. Known values are: "rotate", "notify". + :vartype type: str or ~azure.mgmt.keyvault.v2022_07_01.models.KeyRotationPolicyActionType + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.KeyRotationPolicyActionType"]] = None, + **kwargs + ): + """ + :keyword type: The type of action. Known values are: "rotate", "notify". + :paramtype type: str or ~azure.mgmt.keyvault.v2022_07_01.models.KeyRotationPolicyActionType + """ + super(Action, self).__init__(**kwargs) + self.type = type + + +class Attributes(msrest.serialization.Model): + """The object attributes managed by the KeyVault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ + super(Attributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + + +class CheckMhsmNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the managed hsm name. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The managed hsm name. + :vartype name: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. The managed hsm name. + :paramtype name: str + """ + super(CheckMhsmNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class CheckMhsmNameAvailabilityResult(msrest.serialization.Model): + """The CheckMhsmNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :vartype name_available: bool + :ivar reason: The reason that a managed hsm name could not be used. The reason element is only + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". + :vartype reason: str or ~azure.mgmt.keyvault.v2022_07_01.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CheckMhsmNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CheckNameAvailabilityResult(msrest.serialization.Model): + """The CheckNameAvailability operation response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name_available: A boolean value that indicates whether the name is available for you to + use. If true, the name is available. If false, the name has already been taken or is invalid + and cannot be used. + :vartype name_available: bool + :ivar reason: The reason that a vault name could not be used. The Reason element is only + returned if NameAvailable is false. Known values are: "AccountNameInvalid", "AlreadyExists". + :vartype reason: str or ~azure.mgmt.keyvault.v2022_07_01.models.Reason + :ivar message: An error message explaining the Reason value in more detail. + :vartype message: str + """ + + _validation = { + 'name_available': {'readonly': True}, + 'reason': {'readonly': True}, + 'message': {'readonly': True}, + } + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(CheckNameAvailabilityResult, self).__init__(**kwargs) + self.name_available = None + self.reason = None + self.message = None + + +class CloudErrorBody(msrest.serialization.Model): + """An error response from Key Vault resource provider. + + :ivar code: Error code. This is a mnemonic that can be consumed programmatically. + :vartype code: str + :ivar message: User friendly error message. The message is typically localized and may vary + with service version. + :vartype message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword code: Error code. This is a mnemonic that can be consumed programmatically. + :paramtype code: str + :keyword message: User friendly error message. The message is typically localized and may vary + with service version. + :paramtype message: str + """ + super(CloudErrorBody, self).__init__(**kwargs) + self.code = code + self.message = message + + +class DeletedManagedHsm(msrest.serialization.Model): + """DeletedManagedHsm. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the deleted managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :ivar properties: Properties of the deleted managed HSM. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsmProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'DeletedManagedHsmProperties'}, + } + + def __init__( + self, + *, + properties: Optional["_models.DeletedManagedHsmProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the deleted managed HSM. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsmProperties + """ + super(DeletedManagedHsm, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DeletedManagedHsmListResult(msrest.serialization.Model): + """List of deleted managed HSM Pools. + + :ivar value: The list of deleted managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsm] + :ivar next_link: The URL to get the next set of deleted managed HSM Pools. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.DeletedManagedHsm"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of deleted managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsm] + :keyword next_link: The URL to get the next set of deleted managed HSM Pools. + :paramtype next_link: str + """ + super(DeletedManagedHsmListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedManagedHsmProperties(msrest.serialization.Model): + """Properties of the deleted managed HSM. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar mhsm_id: The resource id of the original managed HSM. + :vartype mhsm_id: str + :ivar location: The location of the original managed HSM. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar purge_protection_enabled: Purge protection status of the original managed HSM. + :vartype purge_protection_enabled: bool + :ivar tags: A set of tags. Tags of the original managed HSM. + :vartype tags: dict[str, str] + """ + + _validation = { + 'mhsm_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'mhsm_id': {'key': 'mhsmId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeletedManagedHsmProperties, self).__init__(**kwargs) + self.mhsm_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.purge_protection_enabled = None + self.tags = None + + +class DeletedVault(msrest.serialization.Model): + """Deleted vault information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The resource ID for the deleted key vault. + :vartype id: str + :ivar name: The name of the key vault. + :vartype name: str + :ivar type: The resource type of the key vault. + :vartype type: str + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedVaultProperties + """ + + _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'}, + 'properties': {'key': 'properties', 'type': 'DeletedVaultProperties'}, + } + + def __init__( + self, + *, + properties: Optional["_models.DeletedVaultProperties"] = None, + **kwargs + ): + """ + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedVaultProperties + """ + super(DeletedVault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.properties = properties + + +class DeletedVaultListResult(msrest.serialization.Model): + """List of vaults. + + :ivar value: The list of deleted vaults. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.DeletedVault] + :ivar next_link: The URL to get the next set of deleted vaults. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedVault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.DeletedVault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of deleted vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.DeletedVault] + :keyword next_link: The URL to get the next set of deleted vaults. + :paramtype next_link: str + """ + super(DeletedVaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class DeletedVaultProperties(msrest.serialization.Model): + """Properties of the deleted vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar vault_id: The resource id of the original vault. + :vartype vault_id: str + :ivar location: The location of the original vault. + :vartype location: str + :ivar deletion_date: The deleted date. + :vartype deletion_date: ~datetime.datetime + :ivar scheduled_purge_date: The scheduled purged date. + :vartype scheduled_purge_date: ~datetime.datetime + :ivar tags: A set of tags. Tags of the original vault. + :vartype tags: dict[str, str] + :ivar purge_protection_enabled: Purge protection status of the original vault. + :vartype purge_protection_enabled: bool + """ + + _validation = { + 'vault_id': {'readonly': True}, + 'location': {'readonly': True}, + 'deletion_date': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + 'tags': {'readonly': True}, + 'purge_protection_enabled': {'readonly': True}, + } + + _attribute_map = { + 'vault_id': {'key': 'vaultId', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'deletion_date': {'key': 'deletionDate', 'type': 'iso-8601'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'purge_protection_enabled': {'key': 'purgeProtectionEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DeletedVaultProperties, self).__init__(**kwargs) + self.vault_id = None + self.location = None + self.deletion_date = None + self.scheduled_purge_date = None + self.tags = None + self.purge_protection_enabled = None + + +class DimensionProperties(msrest.serialization.Model): + """Type of operation: get, read, delete, etc. + + :ivar name: Name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str + :ivar to_be_exported_for_shoebox: Property to specify whether the dimension should be exported + for Shoebox. + :vartype to_be_exported_for_shoebox: bool + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'to_be_exported_for_shoebox': {'key': 'toBeExportedForShoebox', 'type': 'bool'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + to_be_exported_for_shoebox: Optional[bool] = None, + **kwargs + ): + """ + :keyword name: Name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + :keyword to_be_exported_for_shoebox: Property to specify whether the dimension should be + exported for Shoebox. + :paramtype to_be_exported_for_shoebox: bool + """ + super(DimensionProperties, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.to_be_exported_for_shoebox = to_be_exported_for_shoebox + + +class Error(msrest.serialization.Model): + """The server error. + + 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 inner_error: The inner error, contains a more specific error code. + :vartype inner_error: ~azure.mgmt.keyvault.v2022_07_01.models.Error + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'inner_error': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'inner_error': {'key': 'innererror', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Error, self).__init__(**kwargs) + self.code = None + self.message = None + self.inner_error = None + + +class IPRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :vartype value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + **kwargs + ): + """ + :keyword value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' + (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :paramtype value: str + """ + super(IPRule, self).__init__(**kwargs) + self.value = value + + +class Resource(msrest.serialization.Model): + """Key Vault resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.tags = None + + +class Key(Resource): + """The key resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". + :vartype kty: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". + :vartype curve_name: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :ivar rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :vartype rotation_policy: ~azure.mgmt.keyvault.v2022_07_01.models.RotationPolicy + :ivar release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :vartype release_policy: ~azure.mgmt.keyvault.v2022_07_01.models.KeyReleasePolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'attributes': {'key': 'properties.attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'properties.kty', 'type': 'str'}, + 'key_ops': {'key': 'properties.keyOps', 'type': '[str]'}, + 'key_size': {'key': 'properties.keySize', 'type': 'int'}, + 'curve_name': {'key': 'properties.curveName', 'type': 'str'}, + 'key_uri': {'key': 'properties.keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'properties.keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'properties.rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'properties.release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + *, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["_models.RotationPolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, + **kwargs + ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyCurveName + :keyword rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype rotation_policy: ~azure.mgmt.keyvault.v2022_07_01.models.RotationPolicy + :keyword release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype release_policy: ~azure.mgmt.keyvault.v2022_07_01.models.KeyReleasePolicy + """ + super(Key, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = rotation_policy + self.release_policy = release_policy + + +class KeyAttributes(msrest.serialization.Model): + """The object attributes managed by the Azure Key Vault service. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: Determines whether or not the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: long + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: long + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar recovery_level: The deletion recovery level currently in effect for the object. If it + contains 'Purgeable', then the object can be permanently deleted by a privileged user; + otherwise, only the system can purge the object at the end of the retention interval. Known + values are: "Purgeable", "Recoverable+Purgeable", "Recoverable", + "Recoverable+ProtectedSubscription". + :vartype recovery_level: str or ~azure.mgmt.keyvault.v2022_07_01.models.DeletionRecoveryLevel + :ivar exportable: Indicates if the private key can be exported. + :vartype exportable: bool + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + 'recovery_level': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'long'}, + 'expires': {'key': 'exp', 'type': 'long'}, + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'recovery_level': {'key': 'recoveryLevel', 'type': 'str'}, + 'exportable': {'key': 'exportable', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[int] = None, + expires: Optional[int] = None, + exportable: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: Determines whether or not the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: long + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: long + :keyword exportable: Indicates if the private key can be exported. + :paramtype exportable: bool + """ + super(KeyAttributes, self).__init__(**kwargs) + self.enabled = enabled + self.not_before = not_before + self.expires = expires + self.created = None + self.updated = None + self.recovery_level = None + self.exportable = exportable + + +class KeyCreateParameters(msrest.serialization.Model): + """The parameters used to create a key. + + All required parameters must be populated in order to send to Azure. + + :ivar tags: A set of tags. The tags that will be assigned to the key. + :vartype tags: dict[str, str] + :ivar properties: Required. The properties of the key to be created. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.KeyProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'KeyProperties'}, + } + + def __init__( + self, + *, + properties: "_models.KeyProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key. + :paramtype tags: dict[str, str] + :keyword properties: Required. The properties of the key to be created. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.KeyProperties + """ + super(KeyCreateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class KeyListResult(msrest.serialization.Model): + """The page of keys. + + :ivar value: The key resources. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Key] + :ivar next_link: The URL to get the next page of keys. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Key]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Key"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The key resources. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Key] + :keyword next_link: The URL to get the next page of keys. + :paramtype next_link: str + """ + super(KeyListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class KeyProperties(msrest.serialization.Model): + """The properties of the key. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar attributes: The attributes of the key. + :vartype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyAttributes + :ivar kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: "EC", + "EC-HSM", "RSA", "RSA-HSM". + :vartype kty: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyType + :ivar key_ops: + :vartype key_ops: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyOperation] + :ivar key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :vartype key_size: int + :ivar curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". + :vartype curve_name: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyCurveName + :ivar key_uri: The URI to retrieve the current version of the key. + :vartype key_uri: str + :ivar key_uri_with_version: The URI to retrieve the specific version of the key. + :vartype key_uri_with_version: str + :ivar rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :vartype rotation_policy: ~azure.mgmt.keyvault.v2022_07_01.models.RotationPolicy + :ivar release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :vartype release_policy: ~azure.mgmt.keyvault.v2022_07_01.models.KeyReleasePolicy + """ + + _validation = { + 'key_uri': {'readonly': True}, + 'key_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyAttributes'}, + 'kty': {'key': 'kty', 'type': 'str'}, + 'key_ops': {'key': 'keyOps', 'type': '[str]'}, + 'key_size': {'key': 'keySize', 'type': 'int'}, + 'curve_name': {'key': 'curveName', 'type': 'str'}, + 'key_uri': {'key': 'keyUri', 'type': 'str'}, + 'key_uri_with_version': {'key': 'keyUriWithVersion', 'type': 'str'}, + 'rotation_policy': {'key': 'rotationPolicy', 'type': 'RotationPolicy'}, + 'release_policy': {'key': 'release_policy', 'type': 'KeyReleasePolicy'}, + } + + def __init__( + self, + *, + attributes: Optional["_models.KeyAttributes"] = None, + kty: Optional[Union[str, "_models.JsonWebKeyType"]] = None, + key_ops: Optional[List[Union[str, "_models.JsonWebKeyOperation"]]] = None, + key_size: Optional[int] = None, + curve_name: Optional[Union[str, "_models.JsonWebKeyCurveName"]] = None, + rotation_policy: Optional["_models.RotationPolicy"] = None, + release_policy: Optional["_models.KeyReleasePolicy"] = None, + **kwargs + ): + """ + :keyword attributes: The attributes of the key. + :paramtype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyAttributes + :keyword kty: The type of the key. For valid values, see JsonWebKeyType. Known values are: + "EC", "EC-HSM", "RSA", "RSA-HSM". + :paramtype kty: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyType + :keyword key_ops: + :paramtype key_ops: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyOperation] + :keyword key_size: The key size in bits. For example: 2048, 3072, or 4096 for RSA. + :paramtype key_size: int + :keyword curve_name: The elliptic curve name. For valid values, see JsonWebKeyCurveName. Known + values are: "P-256", "P-384", "P-521", "P-256K". + :paramtype curve_name: str or ~azure.mgmt.keyvault.v2022_07_01.models.JsonWebKeyCurveName + :keyword rotation_policy: Key rotation policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype rotation_policy: ~azure.mgmt.keyvault.v2022_07_01.models.RotationPolicy + :keyword release_policy: Key release policy in response. It will be used for both output and + input. Omitted if empty. + :paramtype release_policy: ~azure.mgmt.keyvault.v2022_07_01.models.KeyReleasePolicy + """ + super(KeyProperties, self).__init__(**kwargs) + self.attributes = attributes + self.kty = kty + self.key_ops = key_ops + self.key_size = key_size + self.curve_name = curve_name + self.key_uri = None + self.key_uri_with_version = None + self.rotation_policy = rotation_policy + self.release_policy = release_policy + + +class KeyReleasePolicy(msrest.serialization.Model): + """KeyReleasePolicy. + + :ivar content_type: Content type and version of key release policy. + :vartype content_type: str + :ivar data: Blob encoding the policy rules under which the key can be released. + :vartype data: bytes + """ + + _attribute_map = { + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'data': {'key': 'data', 'type': 'base64'}, + } + + def __init__( + self, + *, + content_type: Optional[str] = "application/json; charset=utf-8", + data: Optional[bytes] = None, + **kwargs + ): + """ + :keyword content_type: Content type and version of key release policy. + :paramtype content_type: str + :keyword data: Blob encoding the policy rules under which the key can be released. + :paramtype data: bytes + """ + super(KeyReleasePolicy, self).__init__(**kwargs) + self.content_type = content_type + self.data = data + + +class KeyRotationPolicyAttributes(msrest.serialization.Model): + """KeyRotationPolicyAttributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: long + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: long + :ivar expiry_time: The expiration time for the new key version. It should be in ISO8601 format. + Eg: 'P90D', 'P1Y'. + :vartype expiry_time: str + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'created': {'key': 'created', 'type': 'long'}, + 'updated': {'key': 'updated', 'type': 'long'}, + 'expiry_time': {'key': 'expiryTime', 'type': 'str'}, + } + + def __init__( + self, + *, + expiry_time: Optional[str] = None, + **kwargs + ): + """ + :keyword expiry_time: The expiration time for the new key version. It should be in ISO8601 + format. Eg: 'P90D', 'P1Y'. + :paramtype expiry_time: str + """ + super(KeyRotationPolicyAttributes, self).__init__(**kwargs) + self.created = None + self.updated = None + self.expiry_time = expiry_time + + +class LifetimeAction(msrest.serialization.Model): + """LifetimeAction. + + :ivar trigger: The trigger of key rotation policy lifetimeAction. + :vartype trigger: ~azure.mgmt.keyvault.v2022_07_01.models.Trigger + :ivar action: The action of key rotation policy lifetimeAction. + :vartype action: ~azure.mgmt.keyvault.v2022_07_01.models.Action + """ + + _attribute_map = { + 'trigger': {'key': 'trigger', 'type': 'Trigger'}, + 'action': {'key': 'action', 'type': 'Action'}, + } + + def __init__( + self, + *, + trigger: Optional["_models.Trigger"] = None, + action: Optional["_models.Action"] = None, + **kwargs + ): + """ + :keyword trigger: The trigger of key rotation policy lifetimeAction. + :paramtype trigger: ~azure.mgmt.keyvault.v2022_07_01.models.Trigger + :keyword action: The action of key rotation policy lifetimeAction. + :paramtype action: ~azure.mgmt.keyvault.v2022_07_01.models.Action + """ + super(LifetimeAction, self).__init__(**kwargs) + self.trigger = trigger + self.action = action + + +class LogSpecification(msrest.serialization.Model): + """Log specification of operation. + + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str + :ivar blob_duration: Blob duration of specification. + :vartype blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + :keyword blob_duration: Blob duration of specification. + :paramtype blob_duration: str + """ + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class ManagedHsmResource(msrest.serialization.Model): + """Managed HSM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2022_07_01.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + """ + super(ManagedHsmResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.sku = sku + self.tags = tags + self.system_data = None + + +class ManagedHsm(ManagedHsmResource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2022_07_01.models.SystemData + :ivar properties: Properties of the managed HSM. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ManagedHsmProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ManagedHsmProperties"] = None, + **kwargs + ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the managed HSM. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmProperties + """ + super(ManagedHsm, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.properties = properties + + +class ManagedHsmError(msrest.serialization.Model): + """The error exception. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: The server error. + :vartype error: ~azure.mgmt.keyvault.v2022_07_01.models.Error + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'Error'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedHsmError, self).__init__(**kwargs) + self.error = None + + +class ManagedHsmListResult(msrest.serialization.Model): + """List of managed HSM Pools. + + :ivar value: The list of managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedHsm]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.ManagedHsm"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ + super(ManagedHsmListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ManagedHsmProperties(msrest.serialization.Model): + """Properties of the managed HSM Pool. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :vartype tenant_id: str + :ivar initial_admin_object_ids: Array of initial administrators object ids for this managed hsm + pool. + :vartype initial_admin_object_ids: list[str] + :ivar hsm_uri: The URI of the managed hsm pool for performing operations on keys. + :vartype hsm_uri: str + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled + for this managed HSM pool. Setting this property to true activates protection against purge for + this managed HSM pool and its content - only the Managed HSM service may initiate a hard, + irrecoverable deletion. The setting is effective only if soft delete is also enabled. Enabling + this functionality is irreversible. + :vartype enable_purge_protection: bool + :ivar create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Known values are: "recover", "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :ivar status_message: Resource Status Message. + :vartype status_message: str + :ivar provisioning_state: Provisioning state. Known values are: "Succeeded", "Provisioning", + "Failed", "Updating", "Deleting", "Activated", "SecurityDomainRestore", "Restoring". + :vartype provisioning_state: str or ~azure.mgmt.keyvault.v2022_07_01.models.ProvisioningState + :ivar network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :vartype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMNetworkRuleSet + :ivar private_endpoint_connections: List of private endpoint connections associated with the + managed hsm pool. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnectionItem] + :ivar public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + :vartype public_network_access: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PublicNetworkAccess + :ivar scheduled_purge_date: The scheduled purge date in UTC. + :vartype scheduled_purge_date: ~datetime.datetime + """ + + _validation = { + 'hsm_uri': {'readonly': True}, + 'status_message': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + 'scheduled_purge_date': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'initial_admin_object_ids': {'key': 'initialAdminObjectIds', 'type': '[str]'}, + 'hsm_uri': {'key': 'hsmUri', 'type': 'str'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'status_message': {'key': 'statusMessage', 'type': 'str'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'network_acls': {'key': 'networkAcls', 'type': 'MHSMNetworkRuleSet'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[MHSMPrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + 'scheduled_purge_date': {'key': 'scheduledPurgeDate', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + initial_admin_object_ids: Optional[List[str]] = None, + enable_soft_delete: Optional[bool] = True, + soft_delete_retention_in_days: Optional[int] = 90, + enable_purge_protection: Optional[bool] = True, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + network_acls: Optional["_models.MHSMNetworkRuleSet"] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + **kwargs + ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the managed HSM pool. + :paramtype tenant_id: str + :keyword initial_admin_object_ids: Array of initial administrators object ids for this managed + hsm pool. + :paramtype initial_admin_object_ids: list[str] + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this managed HSM pool. If it's not set to any value(true or false) when creating + new managed HSM pool, it will be set to true by default. Once set to true, it cannot be + reverted to false. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this managed HSM pool. Setting this property to true activates protection against + purge for this managed HSM pool and its content - only the Managed HSM service may initiate a + hard, irrecoverable deletion. The setting is effective only if soft delete is also enabled. + Enabling this functionality is irreversible. + :paramtype enable_purge_protection: bool + :keyword create_mode: The create mode to indicate whether the resource is being created or is + being recovered from a deleted resource. Known values are: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMNetworkRuleSet + :keyword public_network_access: Control permission for data plane traffic coming from public + networks while private endpoint is enabled. Known values are: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PublicNetworkAccess + """ + super(ManagedHsmProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.initial_admin_object_ids = initial_admin_object_ids + self.hsm_uri = None + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_purge_protection = enable_purge_protection + self.create_mode = create_mode + self.status_message = None + self.provisioning_state = None + self.network_acls = network_acls + self.private_endpoint_connections = None + self.public_network_access = public_network_access + self.scheduled_purge_date = None + + +class ManagedHSMSecurityDomainProperties(msrest.serialization.Model): + """The security domain properties of the managed hsm. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar activation_status: Activation Status. Known values are: "Active", "NotActivated", + "Unknown", "Failed". + :vartype activation_status: str or ~azure.mgmt.keyvault.v2022_07_01.models.ActivationStatus + :ivar activation_status_message: Activation Status Message. + :vartype activation_status_message: str + """ + + _validation = { + 'activation_status': {'readonly': True}, + 'activation_status_message': {'readonly': True}, + } + + _attribute_map = { + 'activation_status': {'key': 'activationStatus', 'type': 'str'}, + 'activation_status_message': {'key': 'activationStatusMessage', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedHSMSecurityDomainProperties, self).__init__(**kwargs) + self.activation_status = None + self.activation_status_message = None + + +class ManagedHsmSku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU Family of the managed HSM Pool. Known values are: "B". + :vartype family: str or ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSkuFamily + :ivar name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", + "Custom_B32". + :vartype name: str or ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + family: Union[str, "_models.ManagedHsmSkuFamily"] = "B", + name: Union[str, "_models.ManagedHsmSkuName"], + **kwargs + ): + """ + :keyword family: Required. SKU Family of the managed HSM Pool. Known values are: "B". + :paramtype family: str or ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSkuFamily + :keyword name: Required. SKU of the managed HSM Pool. Known values are: "Standard_B1", + "Custom_B32". + :paramtype name: str or ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSkuName + """ + super(ManagedHsmSku, self).__init__(**kwargs) + self.family = family + self.name = name + + +class MetricSpecification(msrest.serialization.Model): + """Metric specification of operation. + + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :vartype unit: str + :ivar aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :vartype aggregation_type: str + :ivar supported_aggregation_types: The supported aggregation types for the metrics. + :vartype supported_aggregation_types: list[str] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar lock_aggregation_type: The metric lock aggregation type. + :vartype lock_aggregation_type: str + :ivar dimensions: The dimensions of metric. + :vartype dimensions: list[~azure.mgmt.keyvault.v2022_07_01.models.DimensionProperties] + :ivar fill_gap_with_zero: Property to specify whether to fill gap with zero. + :vartype fill_gap_with_zero: bool + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'display_description': {'key': 'displayDescription', 'type': 'str'}, + 'unit': {'key': 'unit', 'type': 'str'}, + 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, + 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, + 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, + 'lock_aggregation_type': {'key': 'lockAggregationType', 'type': 'str'}, + 'dimensions': {'key': 'dimensions', 'type': '[DimensionProperties]'}, + 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, + 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + display_description: Optional[str] = None, + unit: Optional[str] = None, + aggregation_type: Optional[str] = None, + supported_aggregation_types: Optional[List[str]] = None, + supported_time_grain_types: Optional[List[str]] = None, + lock_aggregation_type: Optional[str] = None, + dimensions: Optional[List["_models.DimensionProperties"]] = None, + fill_gap_with_zero: Optional[bool] = None, + internal_metric_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: The metric unit. Possible values include: 'Bytes', 'Count', 'Milliseconds'. + :paramtype unit: str + :keyword aggregation_type: The metric aggregation type. Possible values include: 'Average', + 'Count', 'Total'. + :paramtype aggregation_type: str + :keyword supported_aggregation_types: The supported aggregation types for the metrics. + :paramtype supported_aggregation_types: list[str] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword lock_aggregation_type: The metric lock aggregation type. + :paramtype lock_aggregation_type: str + :keyword dimensions: The dimensions of metric. + :paramtype dimensions: list[~azure.mgmt.keyvault.v2022_07_01.models.DimensionProperties] + :keyword fill_gap_with_zero: Property to specify whether to fill gap with zero. + :paramtype fill_gap_with_zero: bool + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + """ + super(MetricSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.display_description = display_description + self.unit = unit + self.aggregation_type = aggregation_type + self.supported_aggregation_types = supported_aggregation_types + self.supported_time_grain_types = supported_time_grain_types + self.lock_aggregation_type = lock_aggregation_type + self.dimensions = dimensions + self.fill_gap_with_zero = fill_gap_with_zero + self.internal_metric_name = internal_metric_name + + +class MHSMIPRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific ip address or ip range. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' (simple + IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :vartype value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + **kwargs + ): + """ + :keyword value: Required. An IPv4 address range in CIDR notation, such as '124.56.78.91' + (simple IP address) or '124.56.78.0/24' (all addresses that start with 124.56.78). + :paramtype value: str + """ + super(MHSMIPRule, self).__init__(**kwargs) + self.value = value + + +class MHSMNetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a managed hsm pool. + + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". + :vartype bypass: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleBypassOptions + :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules + match. This is only used after the bypass property has been evaluated. Known values are: + "Allow", "Deny". + :vartype default_action: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMIPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: + list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMVirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[MHSMIPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[MHSMVirtualNetworkRule]'}, + } + + def __init__( + self, + *, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.MHSMIPRule"]] = None, + virtual_network_rules: Optional[List["_models.MHSMVirtualNetworkRule"]] = None, + **kwargs + ): + """ + :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". + :paramtype bypass: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleBypassOptions + :keyword default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Known values are: "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMIPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMVirtualNetworkRule] + """ + super(MHSMNetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.default_action = default_action + self.ip_rules = ip_rules + self.virtual_network_rules = virtual_network_rules + + +class MHSMPrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(MHSMPrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class MHSMPrivateEndpointConnection(ManagedHsmResource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2022_07_01.models.SystemData + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + super(MHSMPrivateEndpointConnection, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class MHSMPrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'MHSMPrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'MHSMPrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.MHSMPrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.MHSMPrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + super(MHSMPrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class MHSMPrivateEndpointConnectionsListResult(msrest.serialization.Model): + """List of private endpoint connections associated with a managed HSM Pools. + + :ivar value: The private endpoint connection associated with a managed HSM Pools. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection] + :ivar next_link: The URL to get the next set of managed HSM Pools. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.MHSMPrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The private endpoint connection associated with a managed HSM Pools. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection] + :keyword next_link: The URL to get the next set of managed HSM Pools. + :paramtype next_link: str + """ + super(MHSMPrivateEndpointConnectionsListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class MHSMPrivateLinkResource(ManagedHsmResource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The Azure Resource Manager resource ID for the managed HSM Pool. + :vartype id: str + :ivar name: The name of the managed HSM Pool. + :vartype name: str + :ivar type: The resource type of the managed HSM Pool. + :vartype type: str + :ivar location: The supported Azure location where the managed HSM Pool should be created. + :vartype location: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the key vault + resource. + :vartype system_data: ~azure.mgmt.keyvault.v2022_07_01.models.SystemData + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'ManagedHsmSku'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + sku: Optional["_models.ManagedHsmSku"] = None, + tags: Optional[Dict[str, str]] = None, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword location: The supported Azure location where the managed HSM Pool should be created. + :paramtype location: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmSku + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ + super(MHSMPrivateLinkResource, self).__init__(location=location, sku=sku, tags=tags, **kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class MHSMPrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MHSMPrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.MHSMPrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkResource] + """ + super(MHSMPrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class MHSMPrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :ivar status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". + :vartype status: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Known values are: "None". + :vartype actions_required: str or ~azure.mgmt.keyvault.v2022_07_01.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Known values are: "None". + :paramtype actions_required: str or ~azure.mgmt.keyvault.v2022_07_01.models.ActionsRequired + """ + super(MHSMPrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class MHSMVirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a managed hsm pool from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :vartype id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + """ + super(MHSMVirtualNetworkRule, self).__init__(**kwargs) + self.id = id + + +class NetworkRuleSet(msrest.serialization.Model): + """A set of rules governing the network accessibility of a vault. + + :ivar bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". + :vartype bypass: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleBypassOptions + :ivar default_action: The default action when no rule from ipRules and from virtualNetworkRules + match. This is only used after the bypass property has been evaluated. Known values are: + "Allow", "Deny". + :vartype default_action: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleAction + :ivar ip_rules: The list of IP address rules. + :vartype ip_rules: list[~azure.mgmt.keyvault.v2022_07_01.models.IPRule] + :ivar virtual_network_rules: The list of virtual network rules. + :vartype virtual_network_rules: + list[~azure.mgmt.keyvault.v2022_07_01.models.VirtualNetworkRule] + """ + + _attribute_map = { + 'bypass': {'key': 'bypass', 'type': 'str'}, + 'default_action': {'key': 'defaultAction', 'type': 'str'}, + 'ip_rules': {'key': 'ipRules', 'type': '[IPRule]'}, + 'virtual_network_rules': {'key': 'virtualNetworkRules', 'type': '[VirtualNetworkRule]'}, + } + + def __init__( + self, + *, + bypass: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + default_action: Optional[Union[str, "_models.NetworkRuleAction"]] = None, + ip_rules: Optional[List["_models.IPRule"]] = None, + virtual_network_rules: Optional[List["_models.VirtualNetworkRule"]] = None, + **kwargs + ): + """ + :keyword bypass: Tells what traffic can bypass network rules. This can be 'AzureServices' or + 'None'. If not specified the default is 'AzureServices'. Known values are: "AzureServices", + "None". + :paramtype bypass: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleBypassOptions + :keyword default_action: The default action when no rule from ipRules and from + virtualNetworkRules match. This is only used after the bypass property has been evaluated. + Known values are: "Allow", "Deny". + :paramtype default_action: str or ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleAction + :keyword ip_rules: The list of IP address rules. + :paramtype ip_rules: list[~azure.mgmt.keyvault.v2022_07_01.models.IPRule] + :keyword virtual_network_rules: The list of virtual network rules. + :paramtype virtual_network_rules: + list[~azure.mgmt.keyvault.v2022_07_01.models.VirtualNetworkRule] + """ + super(NetworkRuleSet, self).__init__(**kwargs) + self.bypass = bypass + self.default_action = default_action + self.ip_rules = ip_rules + self.virtual_network_rules = virtual_network_rules + + +class Operation(msrest.serialization.Model): + """Key Vault REST API operation definition. + + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.keyvault.v2022_07_01.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar is_data_action: Property to specify whether the action is a data action. + :vartype is_data_action: bool + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.keyvault.v2022_07_01.models.ServiceSpecification + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["_models.OperationDisplay"] = None, + origin: Optional[str] = None, + is_data_action: Optional[bool] = None, + service_specification: Optional["_models.ServiceSpecification"] = None, + **kwargs + ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.keyvault.v2022_07_01.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword is_data_action: Property to specify whether the action is a data action. + :paramtype is_data_action: bool + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.keyvault.v2022_07_01.models.ServiceSpecification + """ + super(Operation, self).__init__(**kwargs) + self.name = name + self.display = display + self.origin = origin + self.is_data_action = is_data_action + self.service_specification = service_specification + + +class OperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :ivar provider: Service provider: Microsoft Key Vault. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Service provider: Microsoft Key Vault. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class OperationListResult(msrest.serialization.Model): + """Result of the request to list Storage operations. It contains a list of operations and a URL link to get the next set of results. + + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Operation] + :ivar next_link: The URL to get the next set of operations. + :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 + ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Operation] + :keyword next_link: The URL to get the next set of operations. + :paramtype next_link: str + """ + super(OperationListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class Permissions(msrest.serialization.Model): + """Permissions the identity has for keys, secrets, certificates and storage. + + :ivar keys: Permissions to keys. + :vartype keys: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.KeyPermissions] + :ivar secrets: Permissions to secrets. + :vartype secrets: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.SecretPermissions] + :ivar certificates: Permissions to certificates. + :vartype certificates: list[str or + ~azure.mgmt.keyvault.v2022_07_01.models.CertificatePermissions] + :ivar storage: Permissions to storage accounts. + :vartype storage: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.StoragePermissions] + """ + + _attribute_map = { + 'keys': {'key': 'keys', 'type': '[str]'}, + 'secrets': {'key': 'secrets', 'type': '[str]'}, + 'certificates': {'key': 'certificates', 'type': '[str]'}, + 'storage': {'key': 'storage', 'type': '[str]'}, + } + + def __init__( + self, + *, + keys: Optional[List[Union[str, "_models.KeyPermissions"]]] = None, + secrets: Optional[List[Union[str, "_models.SecretPermissions"]]] = None, + certificates: Optional[List[Union[str, "_models.CertificatePermissions"]]] = None, + storage: Optional[List[Union[str, "_models.StoragePermissions"]]] = None, + **kwargs + ): + """ + :keyword keys: Permissions to keys. + :paramtype keys: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.KeyPermissions] + :keyword secrets: Permissions to secrets. + :paramtype secrets: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.SecretPermissions] + :keyword certificates: Permissions to certificates. + :paramtype certificates: list[str or + ~azure.mgmt.keyvault.v2022_07_01.models.CertificatePermissions] + :keyword storage: Permissions to storage accounts. + :paramtype storage: list[str or ~azure.mgmt.keyvault.v2022_07_01.models.StoragePermissions] + """ + super(Permissions, self).__init__(**kwargs) + self.keys = keys + self.secrets = secrets + self.certificates = certificates + self.storage = storage + + +class PrivateEndpoint(msrest.serialization.Model): + """Private endpoint object properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Full identifier of the private endpoint resource. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """Private endpoint connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + etag: Optional[str] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + """ + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionItem(msrest.serialization.Model): + """Private endpoint connection item. + + :ivar id: Id of private endpoint connection. + :vartype id: str + :ivar etag: Modified whenever there is a change in the state of private endpoint connection. + :vartype etag: str + :ivar private_endpoint: Properties of the private endpoint object. + :vartype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpoint + :ivar private_link_service_connection_state: Approval state of the private link connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: Provisioning state of the private endpoint connection. Known values + are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + etag: Optional[str] = None, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + """ + :keyword id: Id of private endpoint connection. + :paramtype id: str + :keyword etag: Modified whenever there is a change in the state of private endpoint connection. + :paramtype etag: str + :keyword private_endpoint: Properties of the private endpoint object. + :paramtype private_endpoint: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpoint + :keyword private_link_service_connection_state: Approval state of the private link connection. + :paramtype private_link_service_connection_state: + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: Provisioning state of the private endpoint connection. Known + values are: "Succeeded", "Creating", "Updating", "Deleting", "Failed", "Disconnected". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionProvisioningState + """ + super(PrivateEndpointConnectionItem, self).__init__(**kwargs) + self.id = id + self.etag = etag + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResult(msrest.serialization.Model): + """List of private endpoint connections. + + :ivar value: The list of private endpoint connections. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection] + :ivar next_link: The URL to get the next set of private endpoint connections. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateEndpointConnection"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of private endpoint connections. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection] + :keyword next_link: The URL to get the next set of private endpoint connections. + :paramtype next_link: str + """ + super(PrivateEndpointConnectionListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar group_id: Group identifier of private link resource. + :vartype group_id: str + :ivar required_members: Required member names of private link resource. + :vartype required_members: list[str] + :ivar required_zone_names: Required DNS zone names of the the private link resource. + :vartype required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword required_zone_names: Required DNS zone names of the the private link resource. + :paramtype required_zone_names: list[str] + """ + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkResource] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.PrivateLinkResource"]] = None, + **kwargs + ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkResource] + """ + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """An object that represents the approval state of the private link connection. + + :ivar status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". + :vartype status: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval or rejection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Known values are: "None". + :vartype actions_required: str or ~azure.mgmt.keyvault.v2022_07_01.models.ActionsRequired + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, + **kwargs + ): + """ + :keyword status: Indicates whether the connection has been approved, rejected or removed by the + key vault owner. Known values are: "Pending", "Approved", "Rejected", "Disconnected". + :paramtype status: str or + ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval or rejection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. Known values are: "None". + :paramtype actions_required: str or ~azure.mgmt.keyvault.v2022_07_01.models.ActionsRequired + """ + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class ResourceListResult(msrest.serialization.Model): + """List of vault resources. + + :ivar value: The list of vault resources. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Resource] + :ivar next_link: The URL to get the next set of vault resources. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Resource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Resource"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of vault resources. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Resource] + :keyword next_link: The URL to get the next set of vault resources. + :paramtype next_link: str + """ + super(ResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class RotationPolicy(msrest.serialization.Model): + """RotationPolicy. + + :ivar attributes: The attributes of key rotation policy. + :vartype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyRotationPolicyAttributes + :ivar lifetime_actions: The lifetimeActions for key rotation action. + :vartype lifetime_actions: list[~azure.mgmt.keyvault.v2022_07_01.models.LifetimeAction] + """ + + _attribute_map = { + 'attributes': {'key': 'attributes', 'type': 'KeyRotationPolicyAttributes'}, + 'lifetime_actions': {'key': 'lifetimeActions', 'type': '[LifetimeAction]'}, + } + + def __init__( + self, + *, + attributes: Optional["_models.KeyRotationPolicyAttributes"] = None, + lifetime_actions: Optional[List["_models.LifetimeAction"]] = None, + **kwargs + ): + """ + :keyword attributes: The attributes of key rotation policy. + :paramtype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.KeyRotationPolicyAttributes + :keyword lifetime_actions: The lifetimeActions for key rotation action. + :paramtype lifetime_actions: list[~azure.mgmt.keyvault.v2022_07_01.models.LifetimeAction] + """ + super(RotationPolicy, self).__init__(**kwargs) + self.attributes = attributes + self.lifetime_actions = lifetime_actions + + +class Secret(Resource): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'tags': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + *, + properties: "_models.SecretProperties", + **kwargs + ): + """ + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretProperties + """ + super(Secret, self).__init__(**kwargs) + self.properties = properties + + +class SecretAttributes(Attributes): + """The secret management attributes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar enabled: Determines whether the object is enabled. + :vartype enabled: bool + :ivar not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :vartype not_before: ~datetime.datetime + :ivar expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :vartype expires: ~datetime.datetime + :ivar created: Creation time in seconds since 1970-01-01T00:00:00Z. + :vartype created: ~datetime.datetime + :ivar updated: Last updated time in seconds since 1970-01-01T00:00:00Z. + :vartype updated: ~datetime.datetime + """ + + _validation = { + 'created': {'readonly': True}, + 'updated': {'readonly': True}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'not_before': {'key': 'nbf', 'type': 'unix-time'}, + 'expires': {'key': 'exp', 'type': 'unix-time'}, + 'created': {'key': 'created', 'type': 'unix-time'}, + 'updated': {'key': 'updated', 'type': 'unix-time'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + not_before: Optional[datetime.datetime] = None, + expires: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword enabled: Determines whether the object is enabled. + :paramtype enabled: bool + :keyword not_before: Not before date in seconds since 1970-01-01T00:00:00Z. + :paramtype not_before: ~datetime.datetime + :keyword expires: Expiry date in seconds since 1970-01-01T00:00:00Z. + :paramtype expires: ~datetime.datetime + """ + super(SecretAttributes, self).__init__(enabled=enabled, not_before=not_before, expires=expires, **kwargs) + + +class SecretCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a secret. + + All required parameters must be populated in order to send to Azure. + + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretProperties + """ + + _validation = { + 'properties': {'required': True}, + } + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretProperties'}, + } + + def __init__( + self, + *, + properties: "_models.SecretProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretProperties + """ + super(SecretCreateOrUpdateParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class SecretListResult(msrest.serialization.Model): + """List of secrets. + + :ivar value: The list of secrets. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Secret] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Secret"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of secrets. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Secret] + :keyword next_link: The URL to get the next set of secrets. + :paramtype next_link: str + """ + super(SecretListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class SecretPatchParameters(msrest.serialization.Model): + """Parameters for patching a secret. + + :ivar tags: A set of tags. The tags that will be assigned to the secret. + :vartype tags: dict[str, str] + :ivar properties: Properties of the secret. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'SecretPatchProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.SecretPatchProperties"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the secret. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the secret. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.SecretPatchProperties + """ + super(SecretPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class SecretPatchProperties(msrest.serialization.Model): + """Properties of the secret. + + :ivar value: The value of the secret. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.SecretAttributes + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + **kwargs + ): + """ + :keyword value: The value of the secret. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.SecretAttributes + """ + super(SecretPatchProperties, self).__init__(**kwargs) + self.value = value + self.content_type = content_type + self.attributes = attributes + + +class SecretProperties(msrest.serialization.Model): + """Properties of the secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: The value of the secret. NOTE: 'value' will never be returned from the service, as + APIs using this model are is intended for internal use in ARM deployments. Users should use the + data-plane REST service for interaction with vault secrets. + :vartype value: str + :ivar content_type: The content type of the secret. + :vartype content_type: str + :ivar attributes: The attributes of the secret. + :vartype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.SecretAttributes + :ivar secret_uri: The URI to retrieve the current version of the secret. + :vartype secret_uri: str + :ivar secret_uri_with_version: The URI to retrieve the specific version of the secret. + :vartype secret_uri_with_version: str + """ + + _validation = { + 'secret_uri': {'readonly': True}, + 'secret_uri_with_version': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + 'content_type': {'key': 'contentType', 'type': 'str'}, + 'attributes': {'key': 'attributes', 'type': 'SecretAttributes'}, + 'secret_uri': {'key': 'secretUri', 'type': 'str'}, + 'secret_uri_with_version': {'key': 'secretUriWithVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[str] = None, + content_type: Optional[str] = None, + attributes: Optional["_models.SecretAttributes"] = None, + **kwargs + ): + """ + :keyword value: The value of the secret. NOTE: 'value' will never be returned from the service, + as APIs using this model are is intended for internal use in ARM deployments. Users should use + the data-plane REST service for interaction with vault secrets. + :paramtype value: str + :keyword content_type: The content type of the secret. + :paramtype content_type: str + :keyword attributes: The attributes of the secret. + :paramtype attributes: ~azure.mgmt.keyvault.v2022_07_01.models.SecretAttributes + """ + super(SecretProperties, self).__init__(**kwargs) + self.value = value + self.content_type = content_type + self.attributes = attributes + self.secret_uri = None + self.secret_uri_with_version = None + + +class ServiceSpecification(msrest.serialization.Model): + """One property of operation, include log specifications. + + :ivar log_specifications: Log specifications of operation. + :vartype log_specifications: list[~azure.mgmt.keyvault.v2022_07_01.models.LogSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: + list[~azure.mgmt.keyvault.v2022_07_01.models.MetricSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["_models.LogSpecification"]] = None, + metric_specifications: Optional[List["_models.MetricSpecification"]] = None, + **kwargs + ): + """ + :keyword log_specifications: Log specifications of operation. + :paramtype log_specifications: list[~azure.mgmt.keyvault.v2022_07_01.models.LogSpecification] + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: + list[~azure.mgmt.keyvault.v2022_07_01.models.MetricSpecification] + """ + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + self.metric_specifications = metric_specifications + + +class Sku(msrest.serialization.Model): + """SKU details. + + All required parameters must be populated in order to send to Azure. + + :ivar family: Required. SKU family name. Known values are: "A". + :vartype family: str or ~azure.mgmt.keyvault.v2022_07_01.models.SkuFamily + :ivar name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Known values are: "standard", "premium". + :vartype name: str or ~azure.mgmt.keyvault.v2022_07_01.models.SkuName + """ + + _validation = { + 'family': {'required': True}, + 'name': {'required': True}, + } + + _attribute_map = { + 'family': {'key': 'family', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + family: Union[str, "_models.SkuFamily"] = "A", + name: Union[str, "_models.SkuName"], + **kwargs + ): + """ + :keyword family: Required. SKU family name. Known values are: "A". + :paramtype family: str or ~azure.mgmt.keyvault.v2022_07_01.models.SkuFamily + :keyword name: Required. SKU name to specify whether the key vault is a standard vault or a + premium vault. Known values are: "standard", "premium". + :paramtype name: str or ~azure.mgmt.keyvault.v2022_07_01.models.SkuName + """ + super(Sku, self).__init__(**kwargs) + self.family = family + self.name = name + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the key vault resource. + + :ivar created_by: The identity that created the key vault resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the key vault resource. Known values + are: "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.keyvault.v2022_07_01.models.IdentityType + :ivar created_at: The timestamp of the key vault resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the key vault resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the key vault resource. + Known values are: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.keyvault.v2022_07_01.models.IdentityType + :ivar last_modified_at: The timestamp of the key vault resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.IdentityType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.IdentityType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the key vault resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the key vault resource. Known + values are: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.keyvault.v2022_07_01.models.IdentityType + :keyword created_at: The timestamp of the key vault resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the key vault resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the key vault resource. + Known values are: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.keyvault.v2022_07_01.models.IdentityType + :keyword last_modified_at: The timestamp of the key vault resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Trigger(msrest.serialization.Model): + """Trigger. + + :ivar time_after_create: The time duration after key creation to rotate the key. It only + applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :vartype time_after_create: str + :ivar time_before_expiry: The time duration before key expiring to rotate or notify. It will be + in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :vartype time_before_expiry: str + """ + + _attribute_map = { + 'time_after_create': {'key': 'timeAfterCreate', 'type': 'str'}, + 'time_before_expiry': {'key': 'timeBeforeExpiry', 'type': 'str'}, + } + + def __init__( + self, + *, + time_after_create: Optional[str] = None, + time_before_expiry: Optional[str] = None, + **kwargs + ): + """ + :keyword time_after_create: The time duration after key creation to rotate the key. It only + applies to rotate. It will be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :paramtype time_after_create: str + :keyword time_before_expiry: The time duration before key expiring to rotate or notify. It will + be in ISO 8601 duration format. Eg: 'P90D', 'P1Y'. + :paramtype time_before_expiry: str + """ + super(Trigger, self).__init__(**kwargs) + self.time_after_create = time_after_create + self.time_before_expiry = time_before_expiry + + +class Vault(msrest.serialization.Model): + """Resource information with extended details. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified identifier of the key vault resource. + :vartype id: str + :ivar name: Name of the key vault resource. + :vartype name: str + :ivar type: Resource type of the key vault resource. + :vartype type: str + :ivar location: Azure location of the key vault resource. + :vartype location: str + :ivar tags: A set of tags. Tags assigned to the key vault resource. + :vartype tags: dict[str, str] + :ivar system_data: System metadata for the key vault. + :vartype system_data: ~azure.mgmt.keyvault.v2022_07_01.models.SystemData + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + *, + properties: "_models.VaultProperties", + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Azure location of the key vault resource. + :paramtype location: str + :keyword tags: A set of tags. Tags assigned to the key vault resource. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultProperties + """ + super(Vault, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.system_data = None + self.properties = properties + + +class VaultAccessPolicyParameters(msrest.serialization.Model): + """Parameters for updating the access policy in a vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: The resource id of the access policy. + :vartype id: str + :ivar name: The resource name of the access policy. + :vartype name: str + :ivar type: The resource name of the access policy. + :vartype type: str + :ivar location: The resource type of the access policy. + :vartype location: str + :ivar properties: Required. Properties of the access policy. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'readonly': True}, + 'properties': {'required': 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': 'VaultAccessPolicyProperties'}, + } + + def __init__( + self, + *, + properties: "_models.VaultAccessPolicyProperties", + **kwargs + ): + """ + :keyword properties: Required. Properties of the access policy. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyProperties + """ + super(VaultAccessPolicyParameters, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = None + self.properties = properties + + +class VaultAccessPolicyProperties(msrest.serialization.Model): + """Properties of the vault access policy. + + All required parameters must be populated in order to send to Azure. + + :ivar access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :vartype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + """ + + _validation = { + 'access_policies': {'required': True}, + } + + _attribute_map = { + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + } + + def __init__( + self, + *, + access_policies: List["_models.AccessPolicyEntry"], + **kwargs + ): + """ + :keyword access_policies: Required. An array of 0 to 16 identities that have access to the key + vault. All identities in the array must use the same tenant ID as the key vault's tenant ID. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + """ + super(VaultAccessPolicyProperties, self).__init__(**kwargs) + self.access_policies = access_policies + + +class VaultCheckNameAvailabilityParameters(msrest.serialization.Model): + """The parameters used to check the availability of the vault name. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The vault name. + :vartype name: str + :ivar type: The type of resource, Microsoft.KeyVault/vaults. Has constant value: + "Microsoft.KeyVault/vaults". + :vartype type: str + """ + + _validation = { + 'name': {'required': True}, + 'type': {'required': True, 'constant': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + type = "Microsoft.KeyVault/vaults" + + def __init__( + self, + *, + name: str, + **kwargs + ): + """ + :keyword name: Required. The vault name. + :paramtype name: str + """ + super(VaultCheckNameAvailabilityParameters, self).__init__(**kwargs) + self.name = name + + +class VaultCreateOrUpdateParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + All required parameters must be populated in order to send to Azure. + + :ivar location: Required. The supported Azure location where the key vault should be created. + :vartype location: str + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Required. Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultProperties + """ + + _validation = { + 'location': {'required': True}, + 'properties': {'required': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultProperties'}, + } + + def __init__( + self, + *, + location: str, + properties: "_models.VaultProperties", + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword location: Required. The supported Azure location where the key vault should be + created. + :paramtype location: str + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Required. Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultProperties + """ + super(VaultCreateOrUpdateParameters, self).__init__(**kwargs) + self.location = location + self.tags = tags + self.properties = properties + + +class VaultListResult(msrest.serialization.Model): + """List of vaults. + + :ivar value: The list of vaults. + :vartype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Vault] + :ivar next_link: The URL to get the next set of vaults. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Vault]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["_models.Vault"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of vaults. + :paramtype value: list[~azure.mgmt.keyvault.v2022_07_01.models.Vault] + :keyword next_link: The URL to get the next set of vaults. + :paramtype next_link: str + """ + super(VaultListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class VaultPatchParameters(msrest.serialization.Model): + """Parameters for creating or updating a vault. + + :ivar tags: A set of tags. The tags that will be assigned to the key vault. + :vartype tags: dict[str, str] + :ivar properties: Properties of the vault. + :vartype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultPatchProperties + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'properties': {'key': 'properties', 'type': 'VaultPatchProperties'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.VaultPatchProperties"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. The tags that will be assigned to the key vault. + :paramtype tags: dict[str, str] + :keyword properties: Properties of the vault. + :paramtype properties: ~azure.mgmt.keyvault.v2022_07_01.models.VaultPatchProperties + """ + super(VaultPatchParameters, self).__init__(**kwargs) + self.tags = tags + self.properties = properties + + +class VaultPatchProperties(msrest.serialization.Model): + """Properties of the vault. + + :ivar tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :vartype tenant_id: str + :ivar sku: SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.Sku + :ivar access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :vartype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + :ivar enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :vartype enabled_for_deployment: bool + :ivar enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :vartype enabled_for_disk_encryption: bool + :ivar enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :vartype enabled_for_template_deployment: bool + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. + :vartype enable_soft_delete: bool + :ivar enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored. When false, + the key vault will use the access policies specified in vault properties, and any policy stored + on Azure Resource Manager will be ignored. If null or not specified, the value of this property + will not change. + :vartype enable_rbac_authorization: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Known values are: "recover", "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :vartype enable_purge_protection: bool + :ivar network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :vartype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleSet + :ivar public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :vartype public_network_access: str + """ + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: Optional[str] = None, + sku: Optional["_models.Sku"] = None, + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = None, + enable_rbac_authorization: Optional[bool] = None, + soft_delete_retention_in_days: Optional[int] = None, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + public_network_access: Optional[str] = None, + **kwargs + ): + """ + :keyword tenant_id: The Azure Active Directory tenant ID that should be used for authenticating + requests to the key vault. + :paramtype tenant_id: str + :keyword sku: SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.Sku + :keyword access_policies: An array of 0 to 16 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. Once set to true, it cannot be reverted to false. + :paramtype enable_soft_delete: bool + :keyword enable_rbac_authorization: Property that controls how data actions are authorized. + When true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored. When false, + the key vault will use the access policies specified in vault properties, and any policy stored + on Azure Resource Manager will be ignored. If null or not specified, the value of this property + will not change. + :paramtype enable_rbac_authorization: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Known values are: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this vault. Setting this property to true activates protection against purge for + this vault and its content - only the Key Vault service may initiate a hard, irrecoverable + deletion. The setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept false as its value. + :paramtype enable_purge_protection: bool + :keyword network_acls: A collection of rules governing the accessibility of the vault from + specific network locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleSet + :keyword public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :paramtype public_network_access: str + """ + super(VaultPatchProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.enable_rbac_authorization = enable_rbac_authorization + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + self.public_network_access = public_network_access + + +class VaultProperties(msrest.serialization.Model): + """Properties of the vault. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :vartype tenant_id: str + :ivar sku: Required. SKU details. + :vartype sku: ~azure.mgmt.keyvault.v2022_07_01.models.Sku + :ivar access_policies: An array of 0 to 1024 identities that have access to the key vault. All + identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :vartype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + :ivar vault_uri: The URI of the vault for performing operations on keys and secrets. + :vartype vault_uri: str + :ivar hsm_pool_resource_id: The resource id of HSM Pool. + :vartype hsm_pool_resource_id: str + :ivar enabled_for_deployment: Property to specify whether Azure Virtual Machines are permitted + to retrieve certificates stored as secrets from the key vault. + :vartype enabled_for_deployment: bool + :ivar enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :vartype enabled_for_disk_encryption: bool + :ivar enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :vartype enabled_for_template_deployment: bool + :ivar enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + :vartype enable_soft_delete: bool + :ivar soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and <=90. + :vartype soft_delete_retention_in_days: int + :ivar enable_rbac_authorization: Property that controls how data actions are authorized. When + true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored. When false, + the key vault will use the access policies specified in vault properties, and any policy stored + on Azure Resource Manager will be ignored. If null or not specified, the vault is created with + the default value of false. Note that management actions are always authorized with RBAC. + :vartype enable_rbac_authorization: bool + :ivar create_mode: The vault's create mode to indicate whether the vault need to be recovered + or not. Known values are: "recover", "default". + :vartype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :ivar enable_purge_protection: Property specifying whether protection against purge is enabled + for this vault. Setting this property to true activates protection against purge for this vault + and its content - only the Key Vault service may initiate a hard, irrecoverable deletion. The + setting is effective only if soft delete is also enabled. Enabling this functionality is + irreversible - that is, the property does not accept false as its value. + :vartype enable_purge_protection: bool + :ivar network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :vartype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleSet + :ivar provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". + :vartype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.VaultProvisioningState + :ivar private_endpoint_connections: List of private endpoint connections associated with the + key vault. + :vartype private_endpoint_connections: + list[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionItem] + :ivar public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :vartype public_network_access: str + """ + + _validation = { + 'tenant_id': {'required': True}, + 'sku': {'required': True}, + 'hsm_pool_resource_id': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, + } + + _attribute_map = { + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'access_policies': {'key': 'accessPolicies', 'type': '[AccessPolicyEntry]'}, + 'vault_uri': {'key': 'vaultUri', 'type': 'str'}, + 'hsm_pool_resource_id': {'key': 'hsmPoolResourceId', 'type': 'str'}, + 'enabled_for_deployment': {'key': 'enabledForDeployment', 'type': 'bool'}, + 'enabled_for_disk_encryption': {'key': 'enabledForDiskEncryption', 'type': 'bool'}, + 'enabled_for_template_deployment': {'key': 'enabledForTemplateDeployment', 'type': 'bool'}, + 'enable_soft_delete': {'key': 'enableSoftDelete', 'type': 'bool'}, + 'soft_delete_retention_in_days': {'key': 'softDeleteRetentionInDays', 'type': 'int'}, + 'enable_rbac_authorization': {'key': 'enableRbacAuthorization', 'type': 'bool'}, + 'create_mode': {'key': 'createMode', 'type': 'str'}, + 'enable_purge_protection': {'key': 'enablePurgeProtection', 'type': 'bool'}, + 'network_acls': {'key': 'networkAcls', 'type': 'NetworkRuleSet'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'privateEndpointConnections', 'type': '[PrivateEndpointConnectionItem]'}, + 'public_network_access': {'key': 'publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tenant_id: str, + sku: "_models.Sku", + access_policies: Optional[List["_models.AccessPolicyEntry"]] = None, + vault_uri: Optional[str] = None, + enabled_for_deployment: Optional[bool] = None, + enabled_for_disk_encryption: Optional[bool] = None, + enabled_for_template_deployment: Optional[bool] = None, + enable_soft_delete: Optional[bool] = True, + soft_delete_retention_in_days: Optional[int] = 90, + enable_rbac_authorization: Optional[bool] = False, + create_mode: Optional[Union[str, "_models.CreateMode"]] = None, + enable_purge_protection: Optional[bool] = None, + network_acls: Optional["_models.NetworkRuleSet"] = None, + provisioning_state: Optional[Union[str, "_models.VaultProvisioningState"]] = None, + public_network_access: Optional[str] = "enabled", + **kwargs + ): + """ + :keyword tenant_id: Required. The Azure Active Directory tenant ID that should be used for + authenticating requests to the key vault. + :paramtype tenant_id: str + :keyword sku: Required. SKU details. + :paramtype sku: ~azure.mgmt.keyvault.v2022_07_01.models.Sku + :keyword access_policies: An array of 0 to 1024 identities that have access to the key vault. + All identities in the array must use the same tenant ID as the key vault's tenant ID. When + ``createMode`` is set to ``recover``\ , access policies are not required. Otherwise, access + policies are required. + :paramtype access_policies: list[~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyEntry] + :keyword vault_uri: The URI of the vault for performing operations on keys and secrets. + :paramtype vault_uri: str + :keyword enabled_for_deployment: Property to specify whether Azure Virtual Machines are + permitted to retrieve certificates stored as secrets from the key vault. + :paramtype enabled_for_deployment: bool + :keyword enabled_for_disk_encryption: Property to specify whether Azure Disk Encryption is + permitted to retrieve secrets from the vault and unwrap keys. + :paramtype enabled_for_disk_encryption: bool + :keyword enabled_for_template_deployment: Property to specify whether Azure Resource Manager is + permitted to retrieve secrets from the key vault. + :paramtype enabled_for_template_deployment: bool + :keyword enable_soft_delete: Property to specify whether the 'soft delete' functionality is + enabled for this key vault. If it's not set to any value(true or false) when creating new key + vault, it will be set to true by default. Once set to true, it cannot be reverted to false. + :paramtype enable_soft_delete: bool + :keyword soft_delete_retention_in_days: softDelete data retention days. It accepts >=7 and + <=90. + :paramtype soft_delete_retention_in_days: int + :keyword enable_rbac_authorization: Property that controls how data actions are authorized. + When true, the key vault will use Role Based Access Control (RBAC) for authorization of data + actions, and the access policies specified in vault properties will be ignored. When false, + the key vault will use the access policies specified in vault properties, and any policy stored + on Azure Resource Manager will be ignored. If null or not specified, the vault is created with + the default value of false. Note that management actions are always authorized with RBAC. + :paramtype enable_rbac_authorization: bool + :keyword create_mode: The vault's create mode to indicate whether the vault need to be + recovered or not. Known values are: "recover", "default". + :paramtype create_mode: str or ~azure.mgmt.keyvault.v2022_07_01.models.CreateMode + :keyword enable_purge_protection: Property specifying whether protection against purge is + enabled for this vault. Setting this property to true activates protection against purge for + this vault and its content - only the Key Vault service may initiate a hard, irrecoverable + deletion. The setting is effective only if soft delete is also enabled. Enabling this + functionality is irreversible - that is, the property does not accept false as its value. + :paramtype enable_purge_protection: bool + :keyword network_acls: Rules governing the accessibility of the key vault from specific network + locations. + :paramtype network_acls: ~azure.mgmt.keyvault.v2022_07_01.models.NetworkRuleSet + :keyword provisioning_state: Provisioning state of the vault. Known values are: "Succeeded", + "RegisteringDns". + :paramtype provisioning_state: str or + ~azure.mgmt.keyvault.v2022_07_01.models.VaultProvisioningState + :keyword public_network_access: Property to specify whether the vault will accept traffic from + public internet. If set to 'disabled' all traffic except private endpoint traffic and that that + originates from trusted services will be blocked. This will override the set firewall rules, + meaning that even if the firewall rules are present we will not honor the rules. + :paramtype public_network_access: str + """ + super(VaultProperties, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.sku = sku + self.access_policies = access_policies + self.vault_uri = vault_uri + self.hsm_pool_resource_id = None + self.enabled_for_deployment = enabled_for_deployment + self.enabled_for_disk_encryption = enabled_for_disk_encryption + self.enabled_for_template_deployment = enabled_for_template_deployment + self.enable_soft_delete = enable_soft_delete + self.soft_delete_retention_in_days = soft_delete_retention_in_days + self.enable_rbac_authorization = enable_rbac_authorization + self.create_mode = create_mode + self.enable_purge_protection = enable_purge_protection + self.network_acls = network_acls + self.provisioning_state = provisioning_state + self.private_endpoint_connections = None + self.public_network_access = public_network_access + + +class VirtualNetworkRule(msrest.serialization.Model): + """A rule governing the accessibility of a vault from a specific virtual network. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :vartype id: str + :ivar ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :vartype ignore_missing_vnet_service_endpoint: bool + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'ignore_missing_vnet_service_endpoint': {'key': 'ignoreMissingVnetServiceEndpoint', 'type': 'bool'}, + } + + def __init__( + self, + *, + id: str, + ignore_missing_vnet_service_endpoint: Optional[bool] = None, + **kwargs + ): + """ + :keyword id: Required. Full resource id of a vnet subnet, such as + '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + :paramtype id: str + :keyword ignore_missing_vnet_service_endpoint: Property to specify whether NRP will ignore the + check if parent subnet has serviceEndpoints configured. + :paramtype ignore_missing_vnet_service_endpoint: bool + """ + super(VirtualNetworkRule, self).__init__(**kwargs) + self.id = id + self.ignore_missing_vnet_service_endpoint = ignore_missing_vnet_service_endpoint diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/__init__.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/__init__.py new file mode 100644 index 000000000000..49be258e3efc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/__init__.py @@ -0,0 +1,34 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._keys_operations import KeysOperations +from ._vaults_operations import VaultsOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._managed_hsms_operations import ManagedHsmsOperations +from ._mhsm_private_endpoint_connections_operations import MHSMPrivateEndpointConnectionsOperations +from ._mhsm_private_link_resources_operations import MHSMPrivateLinkResourcesOperations +from ._operations import Operations +from ._secrets_operations import SecretsOperations + +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk +__all__ = [ + 'KeysOperations', + 'VaultsOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', + 'ManagedHsmsOperations', + 'MHSMPrivateEndpointConnectionsOperations', + 'MHSMPrivateLinkResourcesOperations', + 'Operations', + 'SecretsOperations', +] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_keys_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_keys_operations.py new file mode 100644 index 000000000000..8d959b0065cf --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_keys_operations.py @@ -0,0 +1,650 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_if_not_exist_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + *, + json: Optional[_models.KeyCreateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_version_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "keyVersion": _SERIALIZER.url("key_version", key_version, 'str', pattern=r'^[a-fA-F0-9]{32}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_versions_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "keyName": _SERIALIZER.url("key_name", key_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + +class KeysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`keys` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def create_if_not_exist( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + parameters: _models.KeyCreateParameters, + **kwargs: Any + ) -> _models.Key: + """Creates the first version of a new key if it does not exist. If it already exists, then the + existing key is returned without any write operations being performed. This API does not create + subsequent versions, and does not update existing keys. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the key vault which contains the key to be created. + :type vault_name: str + :param key_name: The name of the key to be created. + :type key_name: str + :param parameters: The parameters used to create the specified key. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.KeyCreateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + _json = self._serialize.body(parameters, 'KeyCreateParameters') + + request = build_create_if_not_exist_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_if_not_exist.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_if_not_exist.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> _models.Key: + """Gets the current version of the specified key from the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key to be retrieved. + :type vault_name: str + :param key_name: The name of the key to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable[_models.KeyListResult]: + """Lists the keys in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the keys to be retrieved. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("KeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys"} # type: ignore + + @distributed_trace + def get_version( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + key_version: str, + **kwargs: Any + ) -> _models.Key: + """Gets the specified version of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key version to be retrieved. + :type vault_name: str + :param key_name: The name of the key version to be retrieved. + :type key_name: str + :param key_version: The version of the key to be retrieved. + :type key_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Key, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Key + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Key] + + + request = build_get_version_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + key_version=key_version, + api_version=api_version, + template_url=self.get_version.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Key', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_version.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions/{keyVersion}"} # type: ignore + + + @distributed_trace + def list_versions( + self, + resource_group_name: str, + vault_name: str, + key_name: str, + **kwargs: Any + ) -> Iterable[_models.KeyListResult]: + """Lists the versions of the specified key in the specified key vault. + + :param resource_group_name: The name of the resource group which contains the specified key + vault. + :type resource_group_name: str + :param vault_name: The name of the vault which contains the key versions to be retrieved. + :type vault_name: str + :param key_name: The name of the key versions to be retrieved. + :type key_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either KeyListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.KeyListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=self.list_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + key_name=key_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("KeyListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/keys/{keyName}/versions"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py new file mode 100644 index 000000000000..393a8e1e65bc --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_managed_hsms_operations.py @@ -0,0 +1,1427 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.ManagedHsm] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + name: str, + subscription_id: str, + *, + json: Optional[_models.ManagedHsm] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + resource_group_name: str, + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_request( + resource_group_name: str, + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_group_request( + resource_group_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + 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_list_by_subscription_request( + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_deleted_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_deleted_request( + name: str, + location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_purge_deleted_request_initial( + name: str, + location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge") # pylint: disable=line-too-long + path_format_arguments = { + "name": _SERIALIZER.url("name", name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_check_mhsm_name_availability_request( + subscription_id: str, + *, + json: Optional[_models.CheckMhsmNameAvailabilityParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + content=content, + **kwargs + ) + +class ManagedHsmsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`managed_hsms` attribute. + """ + + models = _models + + 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") + + + def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> _models.ManagedHsm: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Create or update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to create or update the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> _models.ManagedHsm: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + + _json = self._serialize.body(parameters, 'ManagedHsm') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + name: str, + parameters: _models.ManagedHsm, + **kwargs: Any + ) -> LROPoller[_models.ManagedHsm]: + """Update a managed HSM Pool in the specified subscription. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param parameters: Parameters to patch the managed HSM Pool. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedHsm or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsm] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedHsm', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Deletes the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool to delete. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Optional[_models.ManagedHsm]: + """Gets the specified managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: The name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsm or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.ManagedHsm]] + + + request = build_get_request( + resource_group_name=resource_group_name, + name=name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.ManagedHsmListResult]: + """The List operation gets information about the managed HSM Pools associated with the + subscription and within the specified resource group. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.ManagedHsmListResult]: + """The List operation gets information about the managed HSM Pools associated with the + subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/managedHSMs"} # type: ignore + + @distributed_trace + def list_deleted( + self, + **kwargs: Any + ) -> Iterable[_models.DeletedManagedHsmListResult]: + """The List operation gets information about the deleted managed HSMs associated with the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedManagedHsmListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsmListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsmListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeletedManagedHsmListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedManagedHSMs"} # type: ignore + + @distributed_trace + def get_deleted( + self, + name: str, + location: str, + **kwargs: Any + ) -> _models.DeletedManagedHsm: + """Gets the specified deleted managed HSM. + + :param name: The name of the deleted managed HSM. + :type name: str + :param location: The location of the deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedManagedHsm, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedManagedHsm + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedManagedHsm] + + + request = build_get_deleted_request( + name=name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DeletedManagedHsm', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}"} # type: ignore + + + def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements + self, + name: str, + location: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_purge_deleted_request_initial( + name=name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, None, response_headers) + + _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge"} # type: ignore + + + @distributed_trace + def begin_purge_deleted( # pylint: disable=inconsistent-return-statements + self, + name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: + """Permanently deletes the specified managed HSM. + + :param name: The name of the soft-deleted managed HSM. + :type name: str + :param location: The location of the soft-deleted managed HSM. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( # type: ignore + name=name, + location=location, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedManagedHSMs/{name}/purge"} # type: ignore + + @distributed_trace + def check_mhsm_name_availability( + self, + mhsm_name: _models.CheckMhsmNameAvailabilityParameters, + **kwargs: Any + ) -> _models.CheckMhsmNameAvailabilityResult: + """Checks that the managed hsm name is valid and is not already in use. + + :param mhsm_name: The name of the managed hsm. + :type mhsm_name: ~azure.mgmt.keyvault.v2022_07_01.models.CheckMhsmNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckMhsmNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.CheckMhsmNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckMhsmNameAvailabilityResult] + + _json = self._serialize.body(mhsm_name, 'CheckMhsmNameAvailabilityParameters') + + request = build_check_mhsm_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_mhsm_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('CheckMhsmNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_mhsm_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkMhsmNameAvailability"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..db9df649cb8e --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_endpoint_connections_operations.py @@ -0,0 +1,593 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections") # 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_put_request( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + *, + json: Optional[_models.MHSMPrivateEndpointConnection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "name": _SERIALIZER.url("name", name, 'str'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + +class MHSMPrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`mhsm_private_endpoint_connections` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> Iterable[_models.MHSMPrivateEndpointConnectionsListResult]: + """The List operation gets information about the private endpoint connections associated with the + managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MHSMPrivateEndpointConnectionsListResult or the + result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnectionsListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnectionsListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("MHSMPrivateEndpointConnectionsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Gets the specified private endpoint connection associated with the managed HSM Pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ManagedHsmError, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def put( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + properties: _models.MHSMPrivateEndpointConnection, + **kwargs: Any + ) -> _models.MHSMPrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + + _json = self._serialize.body(properties, 'MHSMPrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.MHSMPrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.MHSMPrivateEndpointConnection]] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[_models.MHSMPrivateEndpointConnection]: + """Deletes the specified private endpoint connection associated with the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the managed hsm pool. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either MHSMPrivateEndpointConnection or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + name=name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('MHSMPrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_link_resources_operations.py new file mode 100644 index 000000000000..b2cc03ed3603 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_mhsm_private_link_resources_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_mhsm_resource_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources") # 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'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + +class MHSMPrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`mhsm_private_link_resources` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list_by_mhsm_resource( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> _models.MHSMPrivateLinkResourceListResult: + """Gets the private link resources supported for the managed hsm pool. + + :param resource_group_name: Name of the resource group that contains the managed HSM pool. + :type resource_group_name: str + :param name: Name of the managed HSM Pool. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MHSMPrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.MHSMPrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.MHSMPrivateLinkResourceListResult] + + + request = build_list_by_mhsm_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_by_mhsm_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('MHSMPrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_mhsm_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/managedHSMs/{name}/privateLinkResources"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_operations.py new file mode 100644 index 000000000000..3ebfef128be1 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_operations.py @@ -0,0 +1,151 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.KeyVault/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 + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`operations` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable[_models.OperationListResult]: + """Lists all of the available Key Vault Rest API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("OperationListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.KeyVault/operations"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""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/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..3c439a2e0dc0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,594 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_put_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + *, + json: Optional[_models.PrivateEndpointConnection] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_by_resource_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + """Gets the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection or None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def put( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + properties: _models.PrivateEndpointConnection, + **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Updates the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :param properties: The intended state of private endpoint connection. + :type properties: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnection, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + + _json = self._serialize.body(properties, 'PrivateEndpointConnection') + + request = build_put_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.put.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + response_headers = {} + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Azure-AsyncOperation']=self._deserialize('str', response.headers.get('Azure-AsyncOperation')) + + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + def _delete_initial( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> Optional[_models.PrivateEndpointConnection]: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + response_headers = {} + if response.status_code == 200: + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + + if response.status_code == 202: + response_headers['Retry-After']=self._deserialize('int', response.headers.get('Retry-After')) + response_headers['Location']=self._deserialize('str', response.headers.get('Location')) + + + if cls: + return cls(pipeline_response, deserialized, response_headers) + + return deserialized + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + vault_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Deletes the specified private endpoint connection associated with the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :param private_endpoint_connection_name: Name of the private endpoint connection associated + with the key vault. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result + of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace + def list_by_resource( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> Iterable[_models.PrivateEndpointConnectionListResult]: + """The List operation gets information about the private endpoint connections associated with the + vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.PrivateEndpointConnectionListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list_by_resource.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_link_resources_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..eb18b2f17722 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_private_link_resources_operations.py @@ -0,0 +1,146 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_vault_request( + subscription_id: str, + resource_group_name: str, + vault_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources") # 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'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 + ) + +class PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`private_link_resources` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def list_by_vault( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> _models.PrivateLinkResourceListResult: + """Gets the private link resources supported for the key vault. + + :param resource_group_name: Name of the resource group that contains the key vault. + :type resource_group_name: str + :param vault_name: The name of the key vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateLinkResourceListResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.PrivateLinkResourceListResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult] + + + request = build_list_by_vault_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + vault_name=vault_name, + api_version=api_version, + template_url=self.list_by_vault.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_by_vault.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateLinkResources"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py new file mode 100644 index 000000000000..aad5f22b46c0 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_secrets_operations.py @@ -0,0 +1,544 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: Optional[_models.SecretCreateOrUpdateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + secret_name: str, + subscription_id: str, + *, + json: Optional[_models.SecretPatchParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str', pattern=r'^[a-zA-Z0-9-]{1,127}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + resource_group_name: str, + vault_name: str, + secret_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "secretName": _SERIALIZER.url("secret_name", secret_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_request( + resource_group_name: str, + vault_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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 SecretsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`secrets` attribute. + """ + + models = _models + + 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") + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretCreateOrUpdateParameters, + **kwargs: Any + ) -> _models.Secret: + """Create or update a secret in a key vault in the specified subscription. NOTE: This API is + intended for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to create or update the secret. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.SecretCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + _json = self._serialize.body(parameters, 'SecretCreateOrUpdateParameters') + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + parameters: _models.SecretPatchParameters, + **kwargs: Any + ) -> _models.Secret: + """Update a secret in the specified subscription. NOTE: This API is intended for internal use in + ARM deployments. Users should use the data-plane REST service for interaction with vault + secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param secret_name: Name of the secret. + :type secret_name: str + :param parameters: Parameters to patch the secret. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.SecretPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + _json = self._serialize.body(parameters, 'SecretPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Secret', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + secret_name: str, + **kwargs: Any + ) -> _models.Secret: + """Gets the specified secret. NOTE: This API is intended for internal use in ARM deployments. + Users should use the data-plane REST service for interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param secret_name: The name of the secret. + :type secret_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Secret, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Secret + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Secret] + + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + secret_name=secret_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Secret', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets/{secretName}"} # type: ignore + + + @distributed_trace + def list( + self, + resource_group_name: str, + vault_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.SecretListResult]: + """The List operation gets information about the secrets in a vault. NOTE: This API is intended + for internal use in ARM deployments. Users should use the data-plane REST service for + interaction with vault secrets. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SecretListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.SecretListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.SecretListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SecretListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/secrets"} # type: ignore diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py new file mode 100644 index 000000000000..6b2d11437595 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/operations/_vaults_operations.py @@ -0,0 +1,1529 @@ +# pylint: disable=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 typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union, cast + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.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 .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_create_or_update_request_initial( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: Optional[_models.VaultCreateOrUpdateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_update_request( + resource_group_name: str, + vault_name: str, + subscription_id: str, + *, + json: Optional[_models.VaultPatchParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + vault_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_request( + resource_group_name: str, + vault_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_update_access_policy_request( + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + subscription_id: str, + *, + json: Optional[_models.VaultAccessPolicyParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str', pattern=r'^[a-zA-Z0-9-]{3,24}$'), + "operationKind": _SERIALIZER.url("operation_kind", operation_kind, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + 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_list_by_subscription_request( + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_deleted_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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_get_deleted_request( + vault_name: str, + location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}") # pylint: disable=line-too-long + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_purge_deleted_request_initial( + vault_name: str, + location: 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge") # pylint: disable=line-too-long + path_format_arguments = { + "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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_list_request( + 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 {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + 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 = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _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_check_name_availability_request( + subscription_id: str, + *, + json: Optional[_models.VaultCheckNameAvailabilityParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # 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, + content=content, + **kwargs + ) + +class VaultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.keyvault.v2022_07_01.KeyVaultManagementClient`'s + :attr:`vaults` attribute. + """ + + models = _models + + 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") + + + def _create_or_update_initial( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + **kwargs: Any + ) -> _models.Vault: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + _json = self._serialize.body(parameters, 'VaultCreateOrUpdateParameters') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultCreateOrUpdateParameters, + **kwargs: Any + ) -> LROPoller[_models.Vault]: + """Create or update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to create or update the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultCreateOrUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either Vault or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.keyvault.v2022_07_01.models.Vault] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( # type: ignore + resource_group_name=resource_group_name, + vault_name=vault_name, + parameters=parameters, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Vault', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + @distributed_trace + def update( + self, + resource_group_name: str, + vault_name: str, + parameters: _models.VaultPatchParameters, + **kwargs: Any + ) -> _models.Vault: + """Update a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the server belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param parameters: Parameters to patch the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultPatchParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + _json = self._serialize.body(parameters, 'VaultPatchParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('Vault', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault to delete. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + vault_name: str, + **kwargs: Any + ) -> _models.Vault: + """Gets the specified Azure key vault. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: The name of the vault. + :type vault_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Vault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.Vault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Vault] + + + request = build_get_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('Vault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}"} # type: ignore + + + @distributed_trace + def update_access_policy( + self, + resource_group_name: str, + vault_name: str, + operation_kind: Union[str, "_models.AccessPolicyUpdateKind"], + parameters: _models.VaultAccessPolicyParameters, + **kwargs: Any + ) -> _models.VaultAccessPolicyParameters: + """Update access policies in a key vault in the specified subscription. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param vault_name: Name of the vault. + :type vault_name: str + :param operation_kind: Name of the operation. + :type operation_kind: str or ~azure.mgmt.keyvault.v2022_07_01.models.AccessPolicyUpdateKind + :param parameters: Access policy to merge into the vault. + :type parameters: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VaultAccessPolicyParameters, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.VaultAccessPolicyParameters + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultAccessPolicyParameters] + + _json = self._serialize.body(parameters, 'VaultAccessPolicyParameters') + + request = build_update_access_policy_request( + resource_group_name=resource_group_name, + vault_name=vault_name, + operation_kind=operation_kind, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_access_policy.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('VaultAccessPolicyParameters', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update_access_policy.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/accessPolicies/{operationKind}"} # type: ignore + + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.VaultListResult]: + """The List operation gets information about the vaults associated with the subscription and + within the specified resource group. + + :param resource_group_name: The name of the Resource Group to which the vault belongs. + :type resource_group_name: str + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults"} # type: ignore + + @distributed_trace + def list_by_subscription( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.VaultListResult]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VaultListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.VaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.VaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=self.list_by_subscription.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/vaults"} # type: ignore + + @distributed_trace + def list_deleted( + self, + **kwargs: Any + ) -> Iterable[_models.DeletedVaultListResult]: + """Gets information about the deleted vaults in a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DeletedVaultListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.DeletedVaultListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVaultListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_deleted_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DeletedVaultListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/deletedVaults"} # type: ignore + + @distributed_trace + def get_deleted( + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> _models.DeletedVault: + """Gets the deleted Azure key vault. + + :param vault_name: The name of the vault. + :type vault_name: str + :param location: The location of the deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DeletedVault, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.DeletedVault + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.DeletedVault] + + + request = build_get_deleted_request( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get_deleted.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = 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('DeletedVault', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}"} # type: ignore + + + def _purge_deleted_initial( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> None: + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_purge_deleted_request_initial( + vault_name=vault_name, + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self._purge_deleted_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _purge_deleted_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge"} # type: ignore + + + @distributed_trace + def begin_purge_deleted( # pylint: disable=inconsistent-return-statements + self, + vault_name: str, + location: str, + **kwargs: Any + ) -> LROPoller[None]: + """Permanently deletes the specified vault. aka Purges the deleted Azure key vault. + + :param vault_name: The name of the soft-deleted vault. + :type vault_name: str + :param location: The location of the soft-deleted vault. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._purge_deleted_initial( # type: ignore + vault_name=vault_name, + location=location, + api_version=api_version, + cls=lambda x,y,z: x, + headers=_headers, + params=_params, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_purge_deleted.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge"} # type: ignore + + @distributed_trace + def list( + self, + top: Optional[int] = None, + **kwargs: Any + ) -> Iterable[_models.ResourceListResult]: + """The List operation gets information about the vaults associated with the subscription. + + :param top: Maximum number of results to return. Default value is None. + :type top: int + :keyword filter: The filter to apply on the operation. Default value is "resourceType eq + 'Microsoft.KeyVault/vaults'". Note that overriding this default value may result in unsupported + behavior. + :paramtype filter: str + :keyword api_version: Azure Resource Manager Api Version. Default value is "2015-11-01". Note + that overriding this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceListResult or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.keyvault.v2022_07_01.models.ResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + filter = kwargs.pop('filter', _params.pop('$filter', "resourceType eq 'Microsoft.KeyVault/vaults'")) # type: str + api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-11-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ResourceListResult] + + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {}) or {}) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + top=top, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + filter=filter, + api_version=api_version, + top=top, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + 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) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resources"} # type: ignore + + @distributed_trace + def check_name_availability( + self, + vault_name: _models.VaultCheckNameAvailabilityParameters, + **kwargs: Any + ) -> _models.CheckNameAvailabilityResult: + """Checks that the vault name is valid and is not already in use. + + :param vault_name: The name of the vault. + :type vault_name: ~azure.mgmt.keyvault.v2022_07_01.models.VaultCheckNameAvailabilityParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResult, or the result of cls(response) + :rtype: ~azure.mgmt.keyvault.v2022_07_01.models.CheckNameAvailabilityResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + 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 = kwargs.pop('api_version', _params.pop('api-version', "2022-07-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.CheckNameAvailabilityResult] + + _json = self._serialize.body(vault_name, 'VaultCheckNameAvailabilityParameters') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/checkNameAvailability"} # type: ignore + diff --git a/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/py.typed b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2022_07_01/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.pyTestMgmtKeyVaulttest_keyvault.json b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.pyTestMgmtKeyVaulttest_keyvault.json index bbe93b9f2690..51ebfc35f1cc 100644 --- a/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.pyTestMgmtKeyVaulttest_keyvault.json +++ b/sdk/keyvault/azure-mgmt-keyvault/tests/recordings/test_cli_mgmt_keyvault.pyTestMgmtKeyVaulttest_keyvault.json @@ -7,7 +7,7 @@ "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-identity/1.11.0b2 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -17,12 +17,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "1753", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:20 GMT", + "Date": "Tue, 09 Aug 2022 08:07:41 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12744.11 - SCUS ProdSlices", + "x-ms-ests-server": "2.1.13418.10 - SCUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -101,7 +101,7 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b2 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -111,12 +111,12 @@ "Cache-Control": "max-age=86400, private", "Content-Length": "945", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:20 GMT", + "Date": "Tue, 09 Aug 2022 08:07:41 GMT", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Set-Cookie": "[set-cookie;]", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", - "x-ms-ests-server": "2.1.12744.11 - EUS ProdSlices", + "x-ms-ests-server": "2.1.13418.10 - WUS2 ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -172,28 +172,28 @@ "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", - "client-request-id": "076b2ec3-a9ba-4be7-a57e-619300bd8d61", + "client-request-id": "7f8abf74-5681-4771-9fc3-37aeb1f264b7", "Connection": "keep-alive", - "Content-Length": "286", + "Content-Length": "288", "Content-Type": "application/x-www-form-urlencoded", "Cookie": "cookie;", - "User-Agent": "azsdk-python-identity/1.11.0b2 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", + "User-Agent": "azsdk-python-identity/1.11.0b3 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0", "x-client-cpu": "x64", "x-client-current-telemetry": "4|730,0|", "x-client-last-telemetry": "4|0|||", "x-client-os": "linux", "x-client-sku": "MSAL.Python", - "x-client-ver": "1.17.0", + "x-client-ver": "1.18.0", "x-ms-lib-capability": "retry-after, h429" }, - "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=o0XWF_siD-FhI.5AE83-u0GaQHW_GP7cjy\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", + "RequestBody": "client_id=00000000-0000-0000-0000-000000000000\u0026grant_type=client_credentials\u0026client_info=1\u0026client_secret=00000000-0000-0000-0000-000000000000\u0026claims=%7B%22access_token%22%3A\u002B%7B%22xms_cc%22%3A\u002B%7B%22values%22%3A\u002B%5B%22CP1%22%5D%7D%7D%7D\u0026scope=https%3A%2F%2Fmanagement.azure.com%2F.default", "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-store, no-cache", - "client-request-id": "076b2ec3-a9ba-4be7-a57e-619300bd8d61", + "client-request-id": "7f8abf74-5681-4771-9fc3-37aeb1f264b7", "Content-Length": "93", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:20 GMT", + "Date": "Tue, 09 Aug 2022 08:07:42 GMT", "Expires": "-1", "P3P": "CP=\u0022DSP CUR OTPi IND OTRi ONL FIN\u0022", "Pragma": "no-cache", @@ -201,7 +201,7 @@ "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "x-ms-clitelem": "1,0,0,,", - "x-ms-ests-server": "2.1.12744.11 - NCUS ProdSlices", + "x-ms-ests-server": "2.1.13418.10 - EUS ProdSlices", "X-XSS-Protection": "0" }, "ResponseBody": { @@ -212,7 +212,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -220,7 +220,7 @@ "Connection": "keep-alive", "Content-Length": "823", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "location": "eastus", @@ -292,7 +292,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:25 GMT", + "Date": "Tue, 09 Aug 2022 08:07:43 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -301,10 +301,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "aced4da7-93f0-4c42-abd3-38d2560754d3", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "3ffaf091-8258-42a1-b966-5a78c70d1eed", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "WESTUS:20220519T094225Z:aced4da7-93f0-4c42-abd3-38d2560754d3" + "x-ms-routing-request-id": "EASTUS2:20220809T080744Z:3ffaf091-8258-42a1-b966-5a78c70d1eed" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz", @@ -315,10 +315,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-05-19T09:42:23.638Z", + "createdAt": "2022-08-09T08:07:43.049Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-05-19T09:42:23.638Z" + "lastModifiedAt": "2022-08-09T08:07:43.049Z" }, "properties": { "sku": { @@ -389,13 +389,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -403,7 +403,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:54 GMT", + "Date": "Tue, 09 Aug 2022 08:08:14 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -412,10 +412,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "84bc528f-643f-43bb-b34f-472b21c222c2", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "047b546c-7323-4199-89f5-a2711d52016c", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11999", - "x-ms-routing-request-id": "WESTUS:20220519T094255Z:84bc528f-643f-43bb-b34f-472b21c222c2" + "x-ms-routing-request-id": "EASTUS2:20220809T080814Z:047b546c-7323-4199-89f5-a2711d52016c" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz", @@ -426,10 +426,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-05-19T09:42:23.638Z", + "createdAt": "2022-08-09T08:07:43.049Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-05-19T09:42:23.638Z" + "lastModifiedAt": "2022-08-09T08:07:43.049Z" }, "properties": { "sku": { @@ -500,7 +500,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz/accessPolicies/add?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz/accessPolicies/add?api-version=2022-07-01", "RequestMethod": "PUT", "RequestHeaders": { "Accept": "application/json", @@ -508,7 +508,7 @@ "Connection": "keep-alive", "Content-Length": "225", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "properties": { @@ -536,7 +536,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:55 GMT", + "Date": "Tue, 09 Aug 2022 08:08:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -545,10 +545,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "d923f074-ea72-4e20-a3f6-f0b0c9896c4f", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "e7157150-7c24-4329-9b19-c8bb0e73bb1c", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-writes": "1198", - "x-ms-routing-request-id": "WESTUS:20220519T094256Z:d923f074-ea72-4e20-a3f6-f0b0c9896c4f" + "x-ms-routing-request-id": "EASTUS2:20220809T080815Z:e7157150-7c24-4329-9b19-c8bb0e73bb1c" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz/accessPolicies/", @@ -610,13 +610,13 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -624,7 +624,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:55 GMT", + "Date": "Tue, 09 Aug 2022 08:08:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -633,10 +633,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "18ffd4fc-627d-47b7-83f7-06219a20d5b0", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "bf916ae8-e8bf-4c5d-ba0b-9f9bf10026b8", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11998", - "x-ms-routing-request-id": "WESTUS:20220519T094256Z:18ffd4fc-627d-47b7-83f7-06219a20d5b0" + "x-ms-routing-request-id": "EASTUS2:20220809T080815Z:bf916ae8-e8bf-4c5d-ba0b-9f9bf10026b8" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz", @@ -647,10 +647,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-05-19T09:42:23.638Z", + "createdAt": "2022-08-09T08:07:43.049Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-05-19T09:42:55.683Z" + "lastModifiedAt": "2022-08-09T08:08:14.879Z" }, "properties": { "sku": { @@ -721,7 +721,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "PATCH", "RequestHeaders": { "Accept": "application/json", @@ -729,7 +729,7 @@ "Connection": "keep-alive", "Content-Length": "2", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": {}, "StatusCode": 200, @@ -737,7 +737,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:55 GMT", + "Date": "Tue, 09 Aug 2022 08:08:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -746,10 +746,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c2c28279-0d90-4ec9-a8e5-db65d681be40", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "38e48d09-3eaa-4df4-b8ff-89e174284d06", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-writes": "1197", - "x-ms-routing-request-id": "WESTUS:20220519T094256Z:c2c28279-0d90-4ec9-a8e5-db65d681be40" + "x-ms-routing-request-id": "EASTUS2:20220809T080815Z:38e48d09-3eaa-4df4-b8ff-89e174284d06" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz", @@ -760,10 +760,10 @@ "systemData": { "createdBy": "00000000-0000-0000-0000-000000000000", "createdByType": "Application", - "createdAt": "2022-05-19T09:42:23.638Z", + "createdAt": "2022-08-09T08:07:43.049Z", "lastModifiedBy": "00000000-0000-0000-0000-000000000000", "lastModifiedByType": "Application", - "lastModifiedAt": "2022-05-19T09:42:56.37Z" + "lastModifiedAt": "2022-08-09T08:08:15.379Z" }, "properties": { "sku": { @@ -834,7 +834,7 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/checkNameAvailability?api-version=2022-07-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", @@ -842,7 +842,7 @@ "Connection": "keep-alive", "Content-Length": "61", "Content-Type": "application/json", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": { "name": "sample-vault", @@ -853,7 +853,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:56 GMT", + "Date": "Tue, 09 Aug 2022 08:08:15 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -862,10 +862,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "c4a5c197-0063-443a-8f32-3efd4fec14b2", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "ef7a4044-c06b-493a-9052-ca4815ec34bb", + "x-ms-keyvault-service-version": "1.5.455.0", "x-ms-ratelimit-remaining-subscription-reads": "11997", - "x-ms-routing-request-id": "WESTUS:20220519T094257Z:c4a5c197-0063-443a-8f32-3efd4fec14b2" + "x-ms-routing-request-id": "EASTUS2:20220809T080815Z:ef7a4044-c06b-493a-9052-ca4815ec34bb" }, "ResponseBody": { "nameAvailable": false, @@ -874,42 +874,42 @@ } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "DELETE", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 19 May 2022 09:42:59 GMT", + "Date": "Tue, 09 Aug 2022 08:08:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "75786528-7765-4e79-a5cb-4c67190dbe2e", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "12ebb091-0f08-48a0-872b-302d3ead83b0", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-deletes": "14999", - "x-ms-routing-request-id": "WESTUS:20220519T094300Z:75786528-7765-4e79-a5cb-4c67190dbe2e" + "x-ms-routing-request-id": "EASTUS2:20220809T080817Z:12ebb091-0f08-48a0-872b-302d3ead83b0" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxz?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxz?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -917,7 +917,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:42:59 GMT", + "Date": "Tue, 09 Aug 2022 08:08:17 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -926,10 +926,10 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "701c2e1b-ca7d-4e73-89e8-59cf640434a5", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "aedd92b3-1a09-4cb8-95e5-63ef0e48628f", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11996", - "x-ms-routing-request-id": "WESTUS:20220519T094300Z:701c2e1b-ca7d-4e73-89e8-59cf640434a5" + "x-ms-routing-request-id": "EASTUS2:20220809T080817Z:aedd92b3-1a09-4cb8-95e5-63ef0e48628f" }, "ResponseBody": { "id": "/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxz", @@ -939,50 +939,50 @@ "vaultId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.KeyVault/vaults/myValtZikfikxz", "location": "eastus", "tags": {}, - "deletionDate": "2022-05-19T09:42:57Z", - "scheduledPurgeDate": "2022-08-17T09:42:57Z" + "deletionDate": "2022-08-09T08:08:15Z", + "scheduledPurgeDate": "2022-11-07T08:08:15Z" } } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxz/purge?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/deletedVaults/myValtZikfikxz/purge?api-version=2022-07-01", "RequestMethod": "POST", "RequestHeaders": { "Accept": "application/json", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, "ResponseHeaders": { "Cache-Control": "no-cache", "Content-Length": "0", - "Date": "Thu, 19 May 2022 09:43:00 GMT", + "Date": "Tue, 09 Aug 2022 08:08:17 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "2ff51311-c31c-4ad7-a16b-8dee6c30eb68", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "d28678c3-2f5f-4d8e-83cf-52c4246dc1af", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-writes": "1199", - "x-ms-routing-request-id": "WESTUS:20220519T094300Z:2ff51311-c31c-4ad7-a16b-8dee6c30eb68" + "x-ms-routing-request-id": "EASTUS2:20220809T080818Z:d28678c3-2f5f-4d8e-83cf-52c4246dc1af" }, "ResponseBody": null }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -990,33 +990,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:05 GMT", + "Date": "Tue, 09 Aug 2022 08:08:22 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0ebd0ee1-99cd-48f3-b1a7-146ee4417ab8", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "36080ac9-fe5d-4760-ab6e-8d838fff8375", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11995", - "x-ms-routing-request-id": "WESTUS:20220519T094306Z:0ebd0ee1-99cd-48f3-b1a7-146ee4417ab8" + "x-ms-routing-request-id": "EASTUS2:20220809T080823Z:36080ac9-fe5d-4760-ab6e-8d838fff8375" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1024,33 +1024,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:10 GMT", + "Date": "Tue, 09 Aug 2022 08:08:27 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "81947550-9603-4e80-aa9b-c7ffea2779bd", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "1ce5e4ed-a1dc-4286-916e-9f63b2229fbf", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11994", - "x-ms-routing-request-id": "WESTUS:20220519T094311Z:81947550-9603-4e80-aa9b-c7ffea2779bd" + "x-ms-routing-request-id": "EASTUS2:20220809T080828Z:1ce5e4ed-a1dc-4286-916e-9f63b2229fbf" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1058,33 +1058,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:16 GMT", + "Date": "Tue, 09 Aug 2022 08:08:32 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dd521bae-aa47-461e-bc20-863d5f365ecc", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "deae3857-e876-4594-a761-9cb3ba4a63a1", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11993", - "x-ms-routing-request-id": "WESTUS:20220519T094316Z:dd521bae-aa47-461e-bc20-863d5f365ecc" + "x-ms-routing-request-id": "EASTUS2:20220809T080833Z:deae3857-e876-4594-a761-9cb3ba4a63a1" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1092,33 +1092,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:21 GMT", + "Date": "Tue, 09 Aug 2022 08:08:37 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "ed5a8e4f-7583-4c01-8ecc-fe1af4d15000", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "639e50da-28e1-43d4-b26a-32db78ee5594", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11992", - "x-ms-routing-request-id": "WESTUS:20220519T094321Z:ed5a8e4f-7583-4c01-8ecc-fe1af4d15000" + "x-ms-routing-request-id": "EASTUS2:20220809T080838Z:639e50da-28e1-43d4-b26a-32db78ee5594" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1126,33 +1126,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:26 GMT", + "Date": "Tue, 09 Aug 2022 08:08:42 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "5c1cc6f2-57c7-4688-9808-5ac5dc0e5dd0", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "0e6cfac5-dbe8-4372-814a-ddc26a3eea81", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11991", - "x-ms-routing-request-id": "WESTUS:20220519T094326Z:5c1cc6f2-57c7-4688-9808-5ac5dc0e5dd0" + "x-ms-routing-request-id": "EASTUS2:20220809T080843Z:0e6cfac5-dbe8-4372-814a-ddc26a3eea81" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1160,33 +1160,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:31 GMT", + "Date": "Tue, 09 Aug 2022 08:08:47 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "0a79e0aa-0400-488c-8b43-d6af298b0180", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "f84b4e01-b2e1-449b-9729-0bc3a7a41030", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11990", - "x-ms-routing-request-id": "WESTUS:20220519T094331Z:0a79e0aa-0400-488c-8b43-d6af298b0180" + "x-ms-routing-request-id": "EASTUS2:20220809T080848Z:f84b4e01-b2e1-449b-9729-0bc3a7a41030" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 202, @@ -1194,135 +1194,33 @@ "Cache-Control": "no-cache", "Content-Length": "64", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:36 GMT", + "Date": "Tue, 09 Aug 2022 08:08:52 GMT", "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "Pragma": "no-cache", "Retry-After": "5", "Server": "Microsoft-IIS/10.0", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "1513a986-9da0-4dcf-90e3-0673a06b9f6f", - "x-ms-keyvault-service-version": "1.5.372.0", + "x-ms-correlation-request-id": "6bbef6e8-7722-44d2-bbaf-a986945f6a46", + "x-ms-keyvault-service-version": "1.5.468.0", "x-ms-ratelimit-remaining-subscription-reads": "11989", - "x-ms-routing-request-id": "WESTUS:20220519T094336Z:1513a986-9da0-4dcf-90e3-0673a06b9f6f" + "x-ms-routing-request-id": "EASTUS2:20220809T080853Z:6bbef6e8-7722-44d2-bbaf-a986945f6a46" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", + "createdDateTime": "2022-08-09 08:08:18Z", "status": "NotStarted" } }, { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", + "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzk1NjI5Mjk5MDE5NjE3Nnw0MDlBRjhDODhDRDU0N0ExQjRFMjRBQTgzODE4NTk4Ng?api-version=2022-07-01", "RequestMethod": "GET", "RequestHeaders": { "Accept": "*/*", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" - }, - "RequestBody": null, - "StatusCode": 202, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Length": "64", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:41 GMT", - "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "Pragma": "no-cache", - "Retry-After": "5", - "Server": "Microsoft-IIS/10.0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-AspNet-Version": "4.0.30319", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "dbc62e25-d4bb-485d-aed4-3e36902036cb", - "x-ms-keyvault-service-version": "1.5.372.0", - "x-ms-ratelimit-remaining-subscription-reads": "11988", - "x-ms-routing-request-id": "WESTUS:20220519T094341Z:dbc62e25-d4bb-485d-aed4-3e36902036cb" - }, - "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", - "status": "NotStarted" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" - }, - "RequestBody": null, - "StatusCode": 202, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Length": "64", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:46 GMT", - "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "Pragma": "no-cache", - "Retry-After": "5", - "Server": "Microsoft-IIS/10.0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-AspNet-Version": "4.0.30319", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "7866be3c-d6df-4044-88a4-f0dc44df998b", - "x-ms-keyvault-service-version": "1.5.372.0", - "x-ms-ratelimit-remaining-subscription-reads": "11987", - "x-ms-routing-request-id": "WESTUS:20220519T094346Z:7866be3c-d6df-4044-88a4-f0dc44df998b" - }, - "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", - "status": "NotStarted" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" - }, - "RequestBody": null, - "StatusCode": 202, - "ResponseHeaders": { - "Cache-Control": "no-cache", - "Content-Length": "64", - "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:51 GMT", - "Expires": "-1", - "Location": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "Pragma": "no-cache", - "Retry-After": "5", - "Server": "Microsoft-IIS/10.0", - "Strict-Transport-Security": "max-age=31536000; includeSubDomains", - "X-AspNet-Version": "4.0.30319", - "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "48f6c9c3-8dfe-404d-a9f6-1d32c78bdfae", - "x-ms-keyvault-service-version": "1.5.372.0", - "x-ms-ratelimit-remaining-subscription-reads": "11986", - "x-ms-routing-request-id": "WESTUS:20220519T094352Z:48f6c9c3-8dfe-404d-a9f6-1d32c78bdfae" - }, - "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", - "status": "NotStarted" - } - }, - { - "RequestUri": "https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.KeyVault/locations/eastus/operationResults/VVR8MDYzNzg4NTUwMTgxNzY3OTUzN3wzQUREM0RBM0ZEQTA0QzZEQkI2MkI0MUY3MEFGMTg0Mw?api-version=2021-10-01", - "RequestMethod": "GET", - "RequestHeaders": { - "Accept": "*/*", - "Accept-Encoding": "gzip, deflate", - "Connection": "keep-alive", - "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.0.0 Python/3.8.12 (Linux-5.13.0-1023-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" + "User-Agent": "azsdk-python-azure-mgmt-keyvault/10.1.0 Python/3.8.13 (Linux-5.15.0-1014-azure-x86_64-with-glibc2.2.5) VSTS_0fb41ef4-5012-48a9-bf39-4ee3de03ee35_build_2500_0" }, "RequestBody": null, "StatusCode": 200, @@ -1330,7 +1228,7 @@ "Cache-Control": "no-cache", "Content-Encoding": "gzip", "Content-Type": "application/json; charset=utf-8", - "Date": "Thu, 19 May 2022 09:43:56 GMT", + "Date": "Tue, 09 Aug 2022 08:08:57 GMT", "Expires": "-1", "Pragma": "no-cache", "Server": "Microsoft-IIS/10.0", @@ -1339,14 +1237,14 @@ "Vary": "Accept-Encoding", "X-AspNet-Version": "4.0.30319", "X-Content-Type-Options": "nosniff", - "x-ms-correlation-request-id": "211ccbae-4a0f-4ad1-94a3-374879c275fc", - "x-ms-keyvault-service-version": "1.5.372.0", - "x-ms-ratelimit-remaining-subscription-reads": "11985", - "x-ms-routing-request-id": "WESTUS:20220519T094357Z:211ccbae-4a0f-4ad1-94a3-374879c275fc" + "x-ms-correlation-request-id": "a2955c3f-cf0d-4ee0-b19c-9f04f911f74c", + "x-ms-keyvault-service-version": "1.5.468.0", + "x-ms-ratelimit-remaining-subscription-reads": "11988", + "x-ms-routing-request-id": "EASTUS2:20220809T080858Z:a2955c3f-cf0d-4ee0-b19c-9f04f911f74c" }, "ResponseBody": { - "createdDateTime": "2022-05-19 09:43:00Z", - "lastActionDateTime": "2022-05-19 09:43:55Z", + "createdDateTime": "2022-08-09 08:08:18Z", + "lastActionDateTime": "2022-08-09 08:08:54Z", "status": "Succeeded" } } diff --git a/shared_requirements.txt b/shared_requirements.txt index 805e1f2c13fc..f25c7ba4406d 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -370,7 +370,7 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-containerregistry azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-deviceupdate azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-keyvault msrest>=0.6.21 -#override azure-mgmt-keyvault azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-keyvault azure-mgmt-core>=1.3.1,<2.0.0 #override azure-mgmt-orbital msrest>=0.6.21 #override azure-mgmt-orbital azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-appconfiguration azure-mgmt-core>=1.3.0,<2.0.0